DEV Community

Discussion on: The Complete Guide to Full Stack Solana Development with React, Anchor, Rust, and Phantom

Collapse
 
jchs profile image
jchs

At the end of part 1, the app.js generates the following error for me:

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

Not sure what is the issue here...
if I do npm ls react:

futureoffrance@ /mnt/c/Users/unkn0wn/solana/futureoffrance
├─┬ @solana/wallet-adapter-react-ui@0.6.1
│ ├─┬ react-dom@17.0.2
│ │ └── react@17.0.2 deduped
│ └── react@17.0.2
└─┬ @solana/wallet-adapter-react@0.13.1
└── react@17.0.2 deduped

So I see I have react 2 times, but isn't that normal? It's from different modules. I couldn't remove just one there I think...

Any help appreciated
Thank you

Collapse
 
merlox profile image
merlox

you're probaby using useWallet or useState outside of a functional component. Make sure they are inside