Liil' Boo – 14-20 Apr 23
Hey,
I have no clue whats causes that, I've done : npm install react-spring
I'm correctly using/call the hook following the rules of hooks too
react.development.js:88 Uncaught Invariant Violation: 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
Code breaks when I try to use react-spring features
18 Replies
As for the "you might have more than 1 copy of react" , I've done a new create-react-app to be sure, I wrote the same code and did npm install react-spring => same error
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
A Function component, which is used here yet
As for possibilty 1 , the create-react-app gives me React 18
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Yes incoming
Notable adds uuid and React-router-dom V6 but both worked fine before react-spring & react-spring doesn't work even if I remove them
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
I see, so it was a type mismatch / rendering mismatch
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Sure, but how do I revert ?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
How do pick the version ?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Thanks!
Where did you find the solution please ?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
This line
npx create-react-app@17.0.2 my-app
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Nice, I'll try it later
Thank you for your time
This thread hasn’t had any activity in 12 hours, so it’s now locked.
Threads are closed automatically after 12 hours. If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/902647189120118794/967429743114858546