called inside of the body of a function component. This could happen for one of the following reasons: 1. You might have mismatching versions of React and the renderer (such as React DOM) 2. You might be breaking the Rules of Hooks 3. You might have more than one copy of React in the same app See https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.
not wrapped in act(...). When testing, code that causes React state updates should be wrapped into act(...): act(() => { /* fire events that update state */ }); /* assert on the output */ This ensures that you're testing the behavior the user would see in the browser. Learn more at https://fb.me/react-wrap-tests-with-act in TestHook in Suspense
custom hooks in isolation from the components where it's being used. It's better to test the component that's using the hook rather than the hook itself. The React Hooks Testing Library is intended to be used for reusable hooks/libraries. ɿ͍ࣺͯͷΧελϜϑοΫΛɺͦΕ͕༻͞Ε͍ͯΔίϯϙʔ ωϯτ͔ΒΓͯ͠ςετ͢Δ͜ͱ͓קΊ͠·ͤΜɻϑοΫࣗ ମͰͳ͘ɺϑοΫΛ༻͍ͯ͠ΔίϯϙʔωϯτΛςετ͢Δ͜ ͱΛ͓קΊ͠·͢ɻReact Hooks Testing Library ࠶ར༻Մೳͳϑο Ϋ/ϥΠϒϥϦͷͨΊʹ༻͞ΕΔ͜ͱΛҙਤ͍ͯ͠·͢ɻ https://github.com/testing-library/react-testing-library#hooks