Good news! We’ve updated our Learn ReactJS: Part I and Learn ReactJS: Part II courses to use JavaScript ES6. ES6 (the sixth version of ECMAScript, which is the specification JavaScript is based on) introduces new syntax and additional functionality that makes the popular web language even more powerful than before.

Why? Since its release, JavaScript ES6 syntax has quickly become best practice and we believe it is important for anyone learning to code to get the most up-to-date education for what’s relevant in the industry today. Additionally, Facebook (creators of ReactJS) will be deprecating pre-ES6 syntax, which makes it even more important for everyone to learn ES6.

How does this impact you? If you’ve started any of our ReactJS courses, some of the code you wrote may now be invalid under the new syntax. Therefore, if you revisit any of the exercises that got updated, you’ll see the exercise code will have reset to show the new syntax. You can still navigate the course, but you’ll have to redo some exercises if you want to be able to run the code again.

If you don’t want to go back through the course to learn about the new syntax, we’ve outlined all the changes introduced below:

Syntax Changes to Learn ReactJS Courses

Learn ReactJS: Part I, JSX

  • Change var to let or const:

Change  to  or

  • Change var React = require('react'); to import React from 'react';:

Change React require

  • Change var ReactDOM = require('react-dom'); to import ReactDOM from 'react-dom';

Change ReactDOM require

Learn ReactJS: Part I, React Components

Change class definition

  • Change class methods’ syntax to method shorthand, for instance:

Change class methods' syntax to method shorthand

Learn ReactJS: Part I, Components Interacting

  • Use export and export default to export each component instead of module.exports, for example:

Use  to export each component instead of

  • Change local file require statements to import statements, for example:

Change local file require statements to import statements

  • getDefaultProps() should be replaced with static defaultProps object property, for example:

 should be replaced with static  object property

  • Replace getInitialState() with calling super() and setting state in constructor(), for example:

Replace  with calling  and setting   in

  • Bind methods in constructor to replace auto-binding:

Bind methods in  to replace auto-binding

Learn ReactJS: Part II, Advanced React (PropTypes)

  • propTypes instance property should be replaced with static property, for example:

 instance property should be replaced with static property

Related articles

7 articles