Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document is not defined #154

Open
stephanNrich opened this issue Dec 28, 2022 · 2 comments
Open

Document is not defined #154

stephanNrich opened this issue Dec 28, 2022 · 2 comments

Comments

@stephanNrich
Copy link

Hey
I'm using this library in Nextjs, i've tried to use {typeof window !== undefined} but still getting an error that Document is not defined, any suggestions ?

@amir2mi
Copy link

amir2mi commented Dec 31, 2022

Hi, use this snippet before your main render and return if the env is not browser:

if (typeof window !== 'undefined' || !!process?.browser) return null

@ph98
Copy link

ph98 commented Jul 28, 2023

if (typeof document === 'undefined' || typeof window === 'undefined' || !!process?.browser) return null

I'm getting same error after adding this to the component it os not rendering anything.
any workaround?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants