Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid hook call. Hooks can only be called inside of the body of a function component #42

Open
PR1NCE-lab opened this issue Apr 22, 2023 · 2 comments

Comments

@PR1NCE-lab
Copy link

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:

  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://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.
@Aman-web-dev
Copy link

Aman-web-dev commented Jun 11, 2023

I am Getting the Same Issue and I don't know how to solve it I am trying since hours to HELP me OUT

@Omkarkale59
Copy link

i resolve this issue
simple u can just do it this simple steps

  1. npm update latest
  2. deleting the module and .next file
  3. yarn
  4. yarn dev

thnks for reading this
i take 2 days to understand this issue this is hectik for me to resolve this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants