-
Notifications
You must be signed in to change notification settings - Fork 47
Conversation
I am a huge fan of these weekly minutes as they are a great way to stay on top of where the React team is headed. Thanks for taking the time to record these! The transparency is appreciated. |
|
||
* React Native is releasing RC, so [we’re shipping 15.1.0](https://github.com/facebook/react/blob/619b3e850998ad24b9750c83ca20bb95e7638957/CHANGELOG.md#1510-may-20-2016). | ||
* Originally we planned to ship 15.0.3 and 15.1.0, but we don’t plan to maintain two branches anyway, so not worth doing now. | ||
* We will release React versions every two weeks, a couple of days before React Native RCs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm concerned about this. My company hasn't migrated to React 15 yet so seeing that we might have to invest more time in updating libraries is worrying.
Is there any document highlighting pros and cons of moving to faster/slower release cycle? What could be the impact on the ecosystem? Are there any statistics of how fast new React versions are adopted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn’t mean we plan to ship v16 soon. We usually wait at least three months before releasing a new major version, and this isn’t changing.
It means that now we’re on 15.x major, we can ship new features and bug fixes faster. So you’d expect 15.1.0, 15.0.1, 15.0.2, 15.2.0, etc, being released more regularly, and you can adopt them right away. There is no need to “invest more time in updating libraries” because these versions are still 15.x, and you can adopt them at any moment without making changes to your code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updating libraries, even without code changes is not free. You need to check that the changes are not introducing regressions (because of a bug in React or a bug in the interaction between application code and React). I'm not saying switching to two weeks release is bad, just that I don't think it is a change to take lightly, because of the potential effects on the community.
What are the technical reasons to remove createClass? IMHO, this factory function is much better than using the class keyword. |
I believe the reasons are listed in the notes:
As for
We are aware of this annoyance. It is also addressed in the notes:
Eventually class properties are likely to become a solution to this, but until they are part of the standard, they are indeed “holding us back” from deprecating
Specifying a constructor with ES6 classes in React is not required. You can completely skip it. If you do define it, you won’t be able to “forget” to call
Can you elaborate on this?
If you like
So you’ll still be able to use it if you prefer it to the standard language features. |
Note that in most cases you’ll want to use functional stateless components anyway; not |
@gaearon I guess an interim solution would be extracting that functionality to an addons package first so ES6 people don't have to carry those bytes. ;) |
" |
Conceptually and in terms of the API surface they are simpler. They don't have a special magic API like mixins, merging of their lifecycle methods, statics that get copied onto the class, autobinding etc. I understand some of these are conveniences you enjoy, but this doesn't make createClass simpler. As for the binding, it is no different from any other JavaScript code. If createClass didn't exist in the first place, and classes were already available when React was created, nobody would call lack of autobinding surprising. It's easy to get used to, but it's not common in JavaScript at all, and lack of autobinding for the purposes of this discussion can be considered simpler. Again, we understand this is inconvenient. As I just repeated above, these things are still "holding us back". And we hope that class properties will alleviate this pain when they become part of the standard, but this hasn't happened yet.
I can't personally give you any exact benchmarks but I know this has been true for Facebook and Yahoo. This isn't really unexpected: ES classes and createClass follow the same code path after initialisation but createClass() spends time binding all custom methods (as opposed to an opt-in smaller list) and creating class definitions from the spec. It has to be slower by definition because it exists to do more work.
I believe I already replied to this in the comment above. You can't forget a super call, it won't compile.
We can imagine it very well because, as mentioned in the notes, we also have a ton of React components in Facebook using createClass. I would imagine thousands of them. If we proceed with deprecating it, we will do so in an automated way, with no manual effort, and provide a utility to convert them automatically. In fact such utility already exists: https://github.com/reactjs/react-codemod/blob/master/README.md#class We will also provide a package for createClass() users who'd rather keep using it. You'll be able to codemod your codebase to use this package instead automatically. Then you won't think about it again. The reason we want to do it is because we want to reduce confusion caused by having many ways of defining components. createClass() is not something we recommend anymore, so we want to de-emphasise it and remove it from the core. It doesn't mean you'll have to rewrite your code: rather, we will stop recommending it, and it will become like a third party package. |
ES6 classes are more performant. |
@wallclockbuilder Here's a benchmark ( |
I'm using SFC for most Components, which is very convenient! Are there any plans supporting shouldComponentUpdate or a flag like |
Eventually, yes. For now, you can use the workaround from #15 (comment). |
To the discussion about createClass: To my mind may open source projects use the ES6 Syntax and on Stackoverflow there are multiple cases, where users didn't understand why the docs had the other syntax and assumed there would be a functional difference. Moving the docs towards ES6 syntax could help here IMHO and I would love to help! Please ping me if help is wished there ;) |
Feel free to discuss here!