-
-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Changing Stateless components to default to function syntax instead of classes syntex #1197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…in React utility with functional stateless components facebook/react#4972
Hmm, I'm kind of split on this. On the one hand, SFC's are cool and I'd love to see them used more. On the other hand, this raises the lowest common denominator (since they're so new and not as well-known as ES6 components) and are a tad slower (but that would be pre-optimization on our part). I dunno, @gaearon what are you thoughts on this? |
I'm up for changing all examples to functional components where possible. However I don't see why we need Also the comment is unnecessary, and there are some spacing inconsistencies. |
HI @gaearon I added react-stateless-wrapper to make test cases pass because of the below mentioned issue |
I think I might take that as a ding against them right now. They should be testable without throwing in too many libraries. |
The wrapper is 12 lines of code though (https://github.com/ngerritsen/react-stateless-wrapper/blob/master/react-stateless-wrapper.js), and stateless components is a recommended pattern from FB.
https://facebook.github.io/react/docs/reusable-components.html#stateless-functions |
The react-stateless-wrapper misses this feature of React:
https://facebook.github.io/react/docs/context.html#referencing-context-in-stateless-functional-components
|
Heads up! I've a complete repo with the todo example https://github.com/urbanvikingr/todo which I'm currently updating the docs with together @gaearon . |
Based on the work by the Dan's over in #1285, I'm going to close this in favor of the community effort going on over there. Feel free to join in! |
I have changed some examples folder to default stateless components to more cleaner new syntax introduced in react 0.14 , If you like you can merge the changes.