Re:Ask HN: Why Did React Switch to ES6 Classes?
by acemarke on Sunday May 07, 2017 @07:31PM
(#14288284)
The React team has discussed this many times.
`React.createClass` was created at a time when there were no classes as part of the JS language itself, and every library was busy inventing its own class-like inheritance implementation. Now that that classes are an actual part of the language, they're a common standard of syntax and behavior that tools can understand, so there's no reason to keep using a homegrown implementation. In addition, in React 16 the React team will remove `createClass` from the main React package and move it into a separate package, thus shrinking package size.
(I'd normally go dig up some links to comments from the React team, but I'll leave that as an exercise for the asker this time - trust me, you shouldn't have to look too hard.)
`React.createClass` was created at a time when there were no classes as part of the JS language itself, and every library was busy inventing its own class-like inheritance implementation. Now that that classes are an actual part of the language, they're a common standard of syntax and behavior that tools can understand, so there's no reason to keep using a homegrown implementation. In addition, in React 16 the React team will remove `createClass` from the main React package and move it into a separate package, thus shrinking package size.
There's a variety of approaches to manage method binding. See the "Using React with ES6" section of my links list for discussion and information: https://github.com/markerikson/react-redux-links/blob/master...
(I'd normally go dig up some links to comments from the React team, but I'll leave that as an exercise for the asker this time - trust me, you shouldn't have to look too hard.)