March 2019
Intermediate to advanced
350 pages
7h 28m
English
The second way to define a React component is by using the ES2015 classes. The class keyword is widely supported in modern browsers, but we can safely transpile it with Babel, which, supposedly, we already have in our stack if we are writing JSX.
Let's see what it means to create the same button from the previous example using a class:
class Button extends React.Component { render() { return <button />; } }
This new way to define a component was released with React 0.13, and Facebook developers are pushing the community to use it. For example, Dan Abramov, an active member of the community and a Facebook employee, recently said:
Read now
Unlock full access