Skip to content

Conversation

@linuxonrails
Copy link
Collaborator

Port 03 State From TS to JS (ES6 >ES6). This closes Lemoncode/react-by-sample-es6 #4

interface Props {
}

interface State {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interface is something valid in ES6?

userName : string;
}

export class App extends React.Component<Props, State> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this extends <> work fine in Es6?

https://toddmotto.com/react-create-class-versus-component/

}

setUsernameState(event) {
// If the state gets more complex we should use object.assign
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this comment, SetState already does that, sorry it's my fault

@@ -0,0 +1,7 @@
import * as React from 'react';

export const HelloComponent = (props : {userName : string}) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are using .js, types should not apply, or are you using flow?

@@ -0,0 +1,10 @@
import * as React from 'react';

export const NameEditComponent = (props : { userName : string, onChange : (event : any) => any }) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing here, we are using types here, as far as I know ES6 is not typed, and I think we are not using other annotation, does this throws errors when transpiling (babel?)

@linuxonrails
Copy link
Collaborator Author

I think I have fixed all problems :-/ ESLint was a great help!

@brauliodiez
Copy link
Member

Any update on this PR?

@linuxonrails
Copy link
Collaborator Author

Everything is alright?

@brauliodiez
Copy link
Member

I can see.still things like username :string is this valid es6?

@crsanti
Copy link
Member

crsanti commented Nov 7, 2016

I've looked over the changed files and I don't see TS code.

@brauliodiez
Copy link
Member

Sorry, my fault, looking at the wrong tab, apprving and merging as @vicmator or Rocío to update the issue. Good stuff!!!

@brauliodiez brauliodiez merged commit cfcb956 into Lemoncode:master Nov 7, 2016
@linuxonrails
Copy link
Collaborator Author

Thanks!!!

@linuxonrails linuxonrails deleted the port_03_state_from_ts_to_js_es6_issue_#4 branch November 7, 2016 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants