React Component Syntax
In this lesson, we'll study some ways that can make our React component declaration shorter and simpler.
Component syntax evolution
React’s way of defining components has evolved. In its early stages, the React.createClass() method was the default way of creating a React class component. Nowadays, it isn’t used anymore, because, with the rise of JavaScript ES6, the previously used React class component syntax became the default.
However, JavaScript is continually evolving, and thus JavaScript enthusiasts pick up new ways of doing things all the time. That’s why you will often find different syntaxes for React class components. One way of defining a React class component, with state and class methods, is the following:
Get hands-on with 1200+ tech skills courses.