Skip to content

Conversation

@gustavovnicius
Copy link

@gustavovnicius gustavovnicius commented May 24, 2016

ES6 examples instead of React.createClass

ES6 examples instead of React.createClass

Or you can define it as a function (but it will be a stateless `ReactComponent`):
```javascript
let MyComponent = () => {

Choose a reason for hiding this comment

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

Why not const instead?

Copy link
Author

Choose a reason for hiding this comment

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

I think thats the habit. Changed it 😄

@ghost
Copy link

ghost commented May 24, 2016

@gustavovnicius updated the pull request.


Or you can define it as a function (but it will be a stateless `ReactComponent`):
```javascript
const MyComponent = () => {
Copy link
Contributor

@jimfb jimfb May 24, 2016

Choose a reason for hiding this comment

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

Let's change this to:

function MyComponent() {
  return ...;
}

because the syntax es5 is likely more familiar to new users, and has better compatibility across browsers.

@ghost
Copy link

ghost commented May 24, 2016

@gustavovnicius updated the pull request.

@gaearon
Copy link
Collaborator

gaearon commented Oct 23, 2016

Thanks! We removed this section in new docs because it was quite out of date.
We might re-add it in some form in #8060 so please track progress there.

@gaearon gaearon closed this Oct 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants