0

why on tutorial yet use React.createClass and not React.Component? see:

facebook.github.io/react/docs/tutorial.html

must everybody abandon React.createaClass

from official doc: https://facebook.github.io/react/blog/2015/03/10/react-v0.13.html

"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.""

1 Answer 1

1

In another post later on (the one you linked is from March, 2015) they talk about how Mixins are considered harmful, which leads me to believe you should use React.Component wherever you can. This will require you to use some kind of build step, since browsers don't support ES2015 classes, but other than that it's an improvement. Read the article I linked for why and how to make the switch.

Bottom line: Use ES2015 (formerly known as ES6) classes.

Sign up to request clarification or add additional context in comments.

1 Comment

thanks, i dont' need mixins, so i can abandon React.createClass

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.