To Solve Unhandled Rejection (ReferenceError): window is not defined Error You Just Need to use componentDidMount and inside componentDidMount You can Use windows. Here is My Example: componentDidMount() { console.log('window innerHeight is:', window.innerHeight); } Now, Your error should be solved.