Invalid hook call. Hooks can only be called inside of the body of a function component
PR1NCE-lab opened this issue · comments
using react -v : 18.2.0 because next js need react -v : 18.2.0 or above
after running npm run dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info - Disabled SWC as replacement for Babel because of custom Babel configuration ".babelrc" https://nextjs.org/docs/messages/swc-disabled
info - Using external babel configuration from D:....\Reactjs\portfolio_website-main.babelrc
event - compiled client and server successfully in 5.4s (212 modules)
wait - compiling / (client and server)...
event - compiled client and server successfully in 2.7s (287 modules)
Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could
happen for one of the following reasons:
- You might have mismatching versions of React and the renderer (such as React DOM)
- You might be breaking the Rules of Hooks
- You might have more than one copy of React in the same app
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.
I am Getting the Same Issue and I don't know how to solve it I am trying since hours to HELP me OUT
i resolve this issue
simple u can just do it this simple steps
- npm update latest
- deleting the module and .next file
- yarn
- yarn dev
thnks for reading this
i take 2 days to understand this issue this is hectik for me to resolve this