Piero Divasto
Full-stack developer
Lead Consultant
ThoughtWorks
https://www.youtube.com/watch?v=dpw9EHDh2bM
Code reusing
Huge components
Classes are complex
Code reusing - Patterns
High-order components
Code reusing - Patterns
Render props
Code reusing
Wrapping Hell!
Huge components & Complex classes
Similar code spare in different places (lifecycle methods)
Hard to understand
Classes impact performance
Too much boilerplate, binding, etc.
Hooks are functions that let you “hook into” React state and lifecycle features from function components.
Built-in Hooks
Additional Hooks
Only Call Hooks at the Top Level
Don’t call Hooks from regular JavaScript functions
Use set (handler) and use (hook's name) suffix (convention)
Why?: https://reactjs.org/docs/hooks-rules.html
Why?: https://reactjs.org/docs/hooks-rules.html
Less boilerplate
We don't need to use class-based components
Improve code reuse
Decrease complexity
Improve Separation of Concern
Fuente: https://bit.ly/2r4JXFc
Fuente: https://bit.ly/2Q4e3HW
http://github.com/morph3o
https://medium.com/@pierodivasto
https://www.linkedin.com/in/pierodivasto
https://reactjs.org/docs/hooks-overview.html
https://reactjs.org/docs/hooks-state.html
https://reactjs.org/docs/hooks-effect.html
https://medium.com/@dan_abramov/making-sense-of-react-hooks-fdbde8803889
https://www.youtube.com/watch?v=dpw9EHDh2bM
https://github.com/reactjs/rfcs/pull/68
https://github.com/reactjs/rfcs/blob/master/text/0068-react-hooks.md
By Piero Divasto
Presentation about hooks proposal by React team.