diff --git a/src/useOrientation.ts b/src/useOrientation.ts index cb315218b6..fb6aad7731 100644 --- a/src/useOrientation.ts +++ b/src/useOrientation.ts @@ -12,10 +12,10 @@ const defaultState: OrientationState = { }; const useOrientation = (initialState: OrientationState = defaultState) => { - const screen = window.screen; const [state, setState] = useState(initialState); useEffect(() => { + const screen = window.screen; let mounted = true; const onChange = () => {