I'm trying to set up a new React frontend in our m...
# help
r
I'm trying to set up a new React frontend in our mono repo but I keep hitting an issue where we end up with two different React versions in our workspace for seemingly no reason which ends up in an error
Copy code
react.development.js:209 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
When these frontends were located in separate repos they both used React 17, now they're in with the serverless stack they're both using React 18 despite the root
node_modules
having React 17 in it and all
package.json
files have
"^17.0.2"
as the version. The repo is setup with a
package.json
in the root which includes workspaces for the two frontend directories which each have their own
package.json
, I'm currently using
npm
Any help would be much appreciated, I've been trying to work this out for the last few hours! 🤯
t
does running yarn in the root help, sometimes I need to do this
There aren't any react dependencies in any of the sst packages
r
Just in case anyone else stumbles across this switching to
yarn
over
npm
resolved the issue