Warning: Invalid hook call. Hooks can only be called in of the body of a function component.…
I got this warning when I use any of these ( Autocomplete, Formik, YUP, React-Hook-Form, Rect-Select ). Please help, THANKS🙏
4 Replies
Could we see where you used hooks since the last time that there weren't errors
This is not my code but my old code is look like this
My new code and I always use hook inside function
just as a pro tip, it's much more useful to share your code by copy-pasting it to a codeblock in discord, or even better to reproduce the problem on something like jsfiddle or stackblitz and share that. Take a look at the #how-to-ask-good-questions channel and #How To Ask Good Questions post in this forum.
screenshots are hard to read and no one is going to bother retyping your code if they want to try to run it themselves