-
Notifications
You must be signed in to change notification settings - Fork 50.4k
Tutorial ported to ES6 classes or stateless functions #6846
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
getInitialState does not work with ES6 style class instantiations.
class Component extends React.Component {
constructor(props) {
this.state = props;
}
}
|
I actually think that we need to do a more extensive overhaul of the tutorial to make functional and ES6 components fit more naturally. |
|
Why use |
|
@zpao Can you be more specific? I am a beginner in React, inputs would be helpful in porting this tutorial. |
|
@zpao I agree with you, but is there any harm in taking this change since it is incrementally closer to our end goal? |
|
@jimfb If we end up doing a worse job of teaching React, then absolutely. We should be coordinating efforts to update the site for ES6 and make sure it's better. We should not land partial incremental updates that leave us in a state that is not better. |
| text: '' | ||
| } | ||
| } | ||
| handleAuthorChange = (e) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not handleAuthorChange() {?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's put a pin in this for the time being to prevent over-churn. I don't know that we will be encouraging the use of property initializers yet. We'll want to make sure we have some guidelines for code in documentation before we finalize this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should stick with the current version of JavaScript. So no property initalizers.
|
Hey, sorry so much for letting this get stale. This is totally my fault. 😢 We are working on revamping the docs right now. As a first phase we are merging the PRs from #3710 but unfortunately I can't merge yours because we decided to replace this tutorial with a new one written from scratch. |
Issue reference : #3710
Before submitting a pull request, please make sure the following is done...
master.grunt test).grunt lint) - we've done our best to make sure these rules match our internal linting guidelines.