Skip to content

Commit

Permalink
fix: use window inside useEffect
Browse files Browse the repository at this point in the history
  • Loading branch information
kodai3 committed Mar 9, 2021
1 parent 0cb08ba commit 2f33aa8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/useOrientation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand Down

0 comments on commit 2f33aa8

Please sign in to comment.