You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Existing code will be kept class-based and will only be changed to functional components with hooks if it improves readability or makes things more reusable.
For new components it's OK to use hooks with functional components but don't mix hooks & class-based components within a feature - just for code style / readability reasons.
Do we need a special heading to the above copy? Right now I would add React Hooks as heading 1.
My personal opinion is that I would use hooks if it improves reusability e.g. a useResize would be easier to read / understand than a listener for resize event in the constructor or componentDidMount of a class based component. Both implementations are OK and I'm not seeing it as a must have to use hooks - I would prefer class-based components. What is your opinion? Recommend to continue to use class-based components or always use hooks or use both as I'd recommend?
I'm not sure about the point with mixing functional and class-based with-in a feature (2nd last sentence in the copy) - maybe that's also OK to use. What do you think? Maybe I have to create an example to see if it's also OK.
Anything else to add to the copy above?
The text was updated successfully, but these errors were encountered:
@AWolf81
I think it would be easier to discuss if you submit a pr about this. Then, we could easily review and merge. 😄
I'll comment after you create the pr.
Dev. documentation update
Once PR #2990 is merged (which will be soon) we will have the latest React version - yay 🎉.
This will introduce React hooks where I think we need some guiding notes about how we'd like to use them.
I'll create a PR for the style guide update but I'd like to first discuss here if my usage guide is OK and how others thinks about it.
The below copy will be added to the end of Code style document.
Copy
Discussion
React Hooks
as heading 1.useResize
would be easier to read / understand than a listener for resize event in the constructor orcomponentDidMount
of a class based component. Both implementations are OK and I'm not seeing it as a must have to use hooks - I would prefer class-based components. What is your opinion? Recommend to continue to use class-based components or always use hooks or use both as I'd recommend?The text was updated successfully, but these errors were encountered: