React.Component on the path to deprecation. Any thoughts?

Hello Reacters,

I’m reading Learning React, 2nd Edition by by Alex Banks and Eve Porcello. They tells that the class method to create React components, which is the method is taught in the course of Codecademy is on the way being deprecated. What do you think?

I cite the relevant passage in the book. It’s at the end of Chapter 4 “How React works”.

"When class syntax was added to JavaScript with ES 2015, React introduced a new method for creating React components. The React.Component API allowed you to use class syntax to create a new component instance:

class IngredientsList extends React.Component {
  render() {
    return React.createElement(
      "ul",
      { className: "ingredients" },
      this.props.items.map((ingredient, i) =>
        React.createElement("li", { key: i }, ingredient)
      )
    );
  }
}

It’s still possible to create a React component using class syntax, but be forewarned that React.Component is on the path to deprecation as well. Although it’s still supported, you can expect this to go the way of React.createClass , another old friend who shaped you but who you won’t see as often because they moved away and you moved on. From now on, we’ll use functions to create components in this book and only briefly point out older patterns for reference."

1 Like