score:3

Accepted answer

I managed to fix this by changing the structure of the project.

Instead of having a separate package.json and package-lock.json in each of the frontend and backend folders I now have a single package.json and package-lock.json in the root folder (along with a single node_modules folder).

I don't know why this fixes the problem, as outlined in my question above all of my react and react-dom versions seemed to align with one another and I was using hooks correctly.

I also don't particularly love this solution as it forces me (at least with a single repo.) to use a single source for frontend and backend dependencies.

If anyone knows of a better way of managing frontend/backend mixed deps. I'm all ears in the comments.


Related Query

More Query from same tag