Skip to content
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

Using ES6 classes for more idiomatic React? #4

Open
eugene1g opened this issue Mar 24, 2015 · 3 comments
Open

Using ES6 classes for more idiomatic React? #4

eugene1g opened this issue Mar 24, 2015 · 3 comments

Comments

@eugene1g
Copy link
Contributor

Great draft!

Posit: this guide would have a longer lifespan if it shifted away from React.createClass and towards ES6 classes/components. My understanding is that React is rapidly moving towards a purely functional structure, and while using ES6 classes is only a midway step, it is still a step in the right direction.

@mikechau
Copy link
Owner

Thanks!

I plan to be adding the ES6 version as well. Probably after I finish Part 2. My application is still on 0.12.x, but I plan to update the document to have all new things from 0.13.

I will make a note that this guide is initially written for 0.12.x, but will definitely be updated for 0.13.

But if anyone wants to add ES6 examples feel free!

@eddyystop
Copy link

Using ES6 classes means you cannot currently use mixins and mixins are very useful. It should be possible to cobble together a way to use existing mixins in ES6 classes

@xmo-odoo
Copy link
Contributor

It should be possible to cobble together a way to use existing mixins in ES6 classes

Unless React moves away from the existing mixins system entirely and towards higher-order components and class decorators instead which seems to be the case.

The React 0.13 release notes certainly seemed to say that mixins were a stopgap and that they'd be dropped (alongside React.createClass) when an equivalent solution is found using native structures, not that effort would be expended towards adding mixins to ES6 components:

Our eventual goal is for ES6 classes to replace React.createClass completely, but until we have a replacement for current mixin use cases and support for class property initializers in the language, we don't plan to deprecate React.createClass.

See also facebook/react#1380

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

No branches or pull requests

4 participants