Skip to content

Instantly share code, notes, and snippets.

@p32929
Created May 23, 2024 10:31
Show Gist options
  • Save p32929/ae56c53479376059833671790f7cf140 to your computer and use it in GitHub Desktop.
Save p32929/ae56c53479376059833671790f7cf140 to your computer and use it in GitHub Desktop.
disable SSR on a component
import dynamic from 'next/dynamic'
import React from 'react'
const NoSsr = props => (
<React.Fragment>{props.children}</React.Fragment>
)
export default dynamic(() => Promise.resolve(NoSsr), {
ssr: false
})
@p32929
Copy link
Author

p32929 commented May 23, 2024

how to use:

<NoSsr>
  <div className="w-full h-full flex flex-col items-center justify-center py-4">
    No SSR here
  </div>
</NoSsr>;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment