Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript React Basics (retired) Stateful Components Creating a Component Class

React.createClass or class ... extends React.Component???

I'm reading react.js documentation and they use class ... extends React.Component this way of creating a class... Is the same ? I have to learn that?...

Michael Pacey
Michael Pacey
3,038 Points

What you are referring to is JavaScript ES6, it's quickly becoming the standard (and good practice) to write React in ES6 however, it's still optional to do this. If you have trouble understanding ES6 then read this on the official documentation....

[https://facebook.github.io/react/docs/react-without-es6.html]

It's worth diving into ES6 as it certainly has its advantages and makes things slightly more "cutting edge".

Additionally, don't try and use ES6 without Babel as it is still fairly new and is compiled by Babel in order to work.

1 Answer