|
|
|
|
|
by danabramov
3187 days ago
|
|
I think you might be mistaken. `React.createClass` always did autobinding, and it still does. The ES6 classes (which the tutorial now uses) never supported autobinding. React documentation switched from `React.createClass` to ES6 classes because they community already did at that point, and wanted to see the more "mainstream" pattern documented. I'm sorry it wasn't obvious that there is a difference between the function call and the language syntax, but it's definitely not a change in React. The tutorial you mention works fine because `onClick={() => this.handleClick(i)}` is an alternative way to bind methods that also works. That's what the tutorial uses because it's easier to explain React first without diving into how `this` works in ES6 classes. And you can run that code and verify it works. (Every step of the tutorial has a link with a code example.) So no, it has not been broken for a year. We also did blog about ES6 class support: https://reactjs.org/blog/2015/01/27/react-v0.13.0-beta-1.htm... And autobinding of `React.createClass` (which you can still use—it's just in a separate package) is also still documented: https://reactjs.org/docs/react-without-es6.html That said I'm sorry about your bad experience. |
|
> We also did blog about ES6 class support
Not everyone reads blogs all the time. If a new product is released, it's reasonable to expect the documentation to mention the breaking changes.