Skip to content

window causes build to fail in netlify #2

Description

@SujayPrabhu96

Description

Hi team, I am working on gatsby project (gatsby@3.0.2) which builds on netlify on every push. Project fails to build and it throws the following error:
error "window" is not available during server side rendering.

index.js

import React from "react";
import { useResponsive } from "react-hooks-responsive";

const Component = () => {
   const { screenIsAtMost } = useResponsive({ sm: 640 });
   const sm = screenIsAtMost("sm");
   return (
     <div>
        Its Gatsby!!!
     </div>
  )
}

Here is the screenshot of the error:

Screenshot 2021-03-24 at 6 32 21 PM

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions