How to mock React Hooks?
The latest version of React introduces Hooks. Some 3rd-party libraries already provide hooks as an alternative to HOCs, e.g. the translation library react-i18next.
Mocking some functionality is easy using higher order components, we just can export the main component (without the HOC) and pass a mocked function to the props. Is there a generic way (provided by React) how hooks can be mocked?
Some hooks like useState are an important part of the component and there's no need to mock them, but I would like to mock other hooks (e.g. translation or redux if they provide a hook in a future release).