Hi! I have a clean install of WordPress 6.1.1 where I want to use Gutenberg blocks with React and I’ve noticed it comes with React 17 [https://prnt.sc/bVKB5VlSle5O])
In the network tab I can see it loads React 17.0.1 [https://prnt.sc/fLzoppgb-8FI])
Because of this, I can’t use React hooks like `useState` from `@wordpress/element` because it throws this error [https://reactjs.org/docs/error-decoder.html/?invariant=321])
After some digging, I found out `@wordpress/element` requires React 18.2.0 [https://prnt.sc/H3r1ekNT3bV9])
I’ve also tried debugging by using the methods from Duplicate React and indeed it prints false: [https://reactjs.org/warnings/invalid-hook-call-warning.html])
`npm ls react` shows this:
[https://prnt.sc/ussfpbTQeCf6])
Can I upgrade WP to React 18? I can’t see any `package.json` in the wp-includes folder.
So…I really don’t know what’s going on, any help would be appreciated, thank you!
[ad_2]
Try installing the Gutenberg plugin (it comes with a more updated version of Gutenberg).