Is your feature request related to a problem? Please describe.
Unit testing hooks is not easy as hooks can only be invoked inside function components or other hooks. As a result, you have to write a component solely for testing a custom hook and have to work out how to trigger all the various ways in which the hook can be updated.
Describe the solution you'd like.
A link to the React Hooks Testing Library docs should be added to the list of unit testing tools.
Additional context
The react-hooks-testing-library simplifies all of this by allowing you to create a simple test harness for React hooks that handles running them within the body of a function component, as well as providing various useful utility functions for updating the inputs and retrieving the outputs of your custom hooks.
Is your feature request related to a problem? Please describe.
Unit testing hooks is not easy as hooks can only be invoked inside function components or other hooks. As a result, you have to write a component solely for testing a custom hook and have to work out how to trigger all the various ways in which the hook can be updated.
Describe the solution you'd like.
A link to the React Hooks Testing Library docs should be added to the list of unit testing tools.
Additional context
The
react-hooks-testing-library
simplifies all of this by allowing you to create a simple test harness for React hooks that handles running them within the body of a function component, as well as providing various useful utility functions for updating the inputs and retrieving the outputs of your custom hooks.