-
Notifications
You must be signed in to change notification settings - Fork 27
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
FSC post #70
FSC post #70
Conversation
Looks pretty good. My main concern is the "performance" section. The phrasing in the React 0.14 announcement has been confusing people since it was published. SOOOO many people think that FSC's are already optimized, but per this tweet from Dan, they aren't: https://twitter.com/dan_abramov/status/832975119224012800 . The closest they've come so far was the discussion that resulted in the creation of React.PureComponent : facebook/react#6914 . Since FSC's aren't actually optimized yet, in a way they're less performant than class components, because you can't implement That said, this other tweet from Dan says they do still plan some optimizations post-Fiber: https://twitter.com/dan_abramov/status/823818032942379008 . So, might be worth throwing a couple more caveats into that section regarding current behavior and future plans. |
Also, while the comments about defining event handlers in FSC's/ |
@markerikson thank you! I think I agree with you that on both points that I could clarify that a little more. I agree with you RE perf optimisations of inline funcs not making a big diff, but I can probably make that clearer in the post. |
b36d91a
to
4f6ad5b
Compare
@markerikson I updated the content to reflect your comments, which I agree with entirely. Thank you so much! |
Sure. A few other minor bits of feedback:
As a final thought: I think the primary benefit of FSCs is simplicity, and to me they act as a visual signal: "this component is solely props in, rendered UI out". If I see a class component, I do have to scan through to see what lifecycle methods it may be using, and what callbacks it may have. If I see an FSC, I know it isn't doing anything fancy. There are definitely times I'll write a stateless class component so I can define callback methods as class properties (especially if I'm passing prop values into a callback prop), but I'll write FSCs to signal that "this is a very straightforward rendering component". |
@markerikson thank you! That last point is a really good one, I've added it to the post :) |
No description provided.