adrianhajdin / portfolio_website

Tutorial created by Enyel Sequeira, taught by JavaScript Mastery

Home Page:https://www.jsmastery.pro

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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:

  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.

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

  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