Decided to play around with setting up recoil w/ next.js. The issue is it looks like in development mode, recoil looks for the window object which is undefined when next renders the app on the server.
Digging a little deeper, it stems from these window calls in dev mode.
For the time being, I created a workaround that I came up with here essentially loads RecoilRoot(and its children) on the client only.
Would be happy to add a check to see if window is defined before calling any methods on it as well as diving into any other issues that might come up when combing recoil with next :)
Hi @Chrischuck
An alternative temporary solution is to only use the production version of Recoil.
const recoil = require('recoil/dist/recoil.production');
Hi, is this solved yet ? Or must use workaround like mentioned by @Chrischuck
@x4080 - It's landing now, but that takes a bit of time...
@drarmstr Thanks, I'll wait for it
the temporary fix is working with atom but not with atomFamily
Where is the new error occurring?
Most helpful comment
Hi @Chrischuck
An alternative temporary solution is to only use the production version of Recoil.