Use react hooks in a function composition way (Seattle Code Camp 2019)

Опубликовано: 07 Август 2026
на канале: Nan Li
142
1

React hooks allow you to use local states and effects in a functional component, but your functional component is no longer pure, resulting in inline logic, less separation of concerns, less reusablity and harder to test. In this talk, we are trying to create some helper functions to take the hook calls outside of the functional components, compose hook functions and send the result to the functional component as props. As a result, your functional component is kept pure.

All the helper functions are published as an npm package hookompose.

https://github.com/ln613/hookompose