I’m in a NextJS app that I’ve recently upgraded from NextJS 12 to 14, and upgraded React from 16 to 18… plus a bunch of other libraries. It’s been a trek, and all the things are upgraded.
I am getting the following error on the frontend (but not on SSR).
TypeError: can't access property "useState", dispatcher is null
const UseModal = () => {
> 4 | const [isActive, setIsActive] = useState<boolean>(false);
Google and openai tell me that I may have multiple versions of react.
However I am using the resolutions
package.json
field with Yarn 4 and believe I have ensured this isn’t the case:
yarn info react
└─ react@npm:18.3.1
├─ Version: 18.3.1
│
└─ Dependencies
└─ loose-envify@npm:^1.1.0 → npm:1.4.0
yarn info react-dom
└─ react-dom@npm:18.3.1
├─ Instances: 1
├─ Version: 18.3.1
│
└─ Dependencies
├─ loose-envify@npm:^1.1.0 → npm:1.4.0
└─ scheduler@npm:^0.23.2 → npm:0.23.2
Any thoughts on this issue? References, or ideas? I’m feeling stuck. Thank you.