recoil-sync window is not defined in NextJS using SSR
See original GitHub issueHello!
I’m seeing this error when trying to use recoil-sync
with NextJS. I assume it’s something to do with SSR.
index.js?46cb:352 Uncaught at getURL (file:///sites/node_modules/recoil-sync/cjs/index.js:2001:33)
at <unknown> (file:///sites/node_modules/recoil-sync/cjs/index.js:2031:36)
at useRecoilURLSync (file:///sites/node_modules/recoil-sync/cjs/index.js:2036:26)
at useRecoilURLSyncJSON (file:///sites/node_modules/recoil-sync/cjs/index.js:2178:3)
at RecoilURLSyncJSON (file:///sites/node_modules/recoil-sync/cjs/index.js:2185:3)
at processChild (file:///sites/node_modules/react-dom/cjs/react-dom-server.node.development.js:3353:14)
at resolve (file:///sites/node_modules/react-dom/cjs/react-dom-server.node.development.js:3270:5)
at ReactDOMServerRenderer.render (file:///sites/node_modules/react-dom/cjs/react-dom-server.node.development.js:3753:22)
at ReactDOMServerRenderer.read (file:///sites/node_modules/react-dom/cjs/react-dom-server.node.development.js:3690:29)
at Object.renderToString (file:///sites/node_modules/react-dom/cjs/react-dom-server.node.development.js:4298:27)
Recoil 7.2
Recoil-sync 0.0.1-alpha.1
NextJS 12.1.0
React 17.0.2
Issue Analytics
- State:
- Created a year ago
- Reactions:4
- Comments:16 (9 by maintainers)
Top Results From Across the Web
Window is not defined in Next.js React app - Stack Overflow
I am using it to dynamically import libaries that are not compatible with SSR in next.js, since its own dynamic import is only...
Read more >How to Fix "window is not defined" in Next.js - Upmostly
This issue has to do with Server-Side Rendering in Next.js. Next.js will by default try to use SSR for your site.
Read more >How to solve Next.js window is not defined
Solve a the common ReferenceError: next.js window is not defined error that you may see when doing SSR & pre-rendering.
Read more >How to solve "window is not defined" errors in React and Next.js
js world, window is not defined, window is only available in browsers. There are three ways to solve that: 1. First solution: typeof....
Read more >Recoil Sync Stores for Next.js - Morioh
atom , but initial value can be specified when using it. Note: This is just a utility and does not depend on either...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah, my mistake!
Confirmed this is working
Thank you for your patience in helping me with this.
currently the usage of refine should be