Created
May 8, 2024 11:33
-
-
Save user24/9bd5be0a6a435eb7ac834ce2b6f394fd 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 { useEffect, useState } from 'react'; | |
const ClientSideApp = ({ children }) => { | |
// Make Next OK with fully client-side rendering, as described in https://colinhacks.com/essays/building-a-spa-with-nextjs | |
const [render, setRender] = useState(false); | |
useEffect(() => setRender(true), []); | |
return render ? children : null; | |
}; | |
function App ({ Component, pageProps }) { | |
return <ClientSideApp> | |
<Component {...pageProps} /> | |
</ClientSideApp>; | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment