Skip to content

window causes build to fail in netlify #2

@SujayPrabhu96

Description

@SujayPrabhu96

Description

Hi team, I am working on gatsby project ([email protected]) 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

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