-
-
Save matiasmm/1d87a1221e14345b1153d296e25e4bbc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from "react" | |
import dynamic from 'next/dynamic'; | |
import { RecoilRoot } from "recoil"; | |
import "../styles/globals.css" | |
function MyApp({ Component, pageProps }): JSX.Element { | |
const [root, setRoot] = React.useState(null) | |
const RecoilizeDebugger = dynamic( | |
() => { | |
return import('recoilize'); | |
}, | |
{ ssr: false } | |
); | |
React.useEffect(() => { | |
if (typeof window.document !== 'undefined') { | |
setRoot(document.getElementById('__next')); | |
} | |
}, [root]); | |
return ( | |
<RecoilRoot> | |
<RecoilizeDebugger root={root} /> // <- error here | |
<Component {...pageProps} /> | |
</RecoilRoot> | |
) | |
} | |
export default MyApp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment