1

I'm a beginner in React.JS and trying to figure out what the advantages of the newer approach with "class SimpleComponent extends Component{}" towards "React.createClass()" is. Would be great if someone can explain me that :-)

1 Answer 1

1

Because React.createClass({...}) is deprecated as of April 2017.

When React was initially released, there was no idiomatic way to create classes in JavaScript, so we provided our own: React.createClass.

Later, classes were added to the language as part of ES2015, so we added the ability to create React components using JavaScript classes. Along with functional components, JavaScript classes are now the preferred way to create components in React.

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

Comments

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.