-
Notifications
You must be signed in to change notification settings - Fork 40
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
gatsby: window is not defined #57
Comments
@bfine9618 |
getting the same thing. i am using Next.js and the newest version of filestack-react |
Ive partially figured this out. the 'window' object is not available on SSR react projects, so you need to dynamically import the module on componentDidMount or with a library. Next.js has dynamic imports-- im sure gatsby has something similar. This would be nice if it were mentioned in the docs |
I found a solution without dynamic imports: use the Client import from filestack-js. You have to import the js script into the gatsby-ssr file. I do it in the onRenderBody
Then in your file you can import the filestack client in the component like this: then you can use a normal html file import with the onChange function that looks like: |
Rendering filestack using gatsby throws the following error. Please help.
The text was updated successfully, but these errors were encountered: