Skip to content

Commit

Permalink
ts-ignore window
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielOliver committed May 26, 2023
1 parent 6ca771f commit 81a5ae0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/ui/useWindowSize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,19 @@ function useWindowSize() {
function handleResize() {
// Set window width/height to state
setWindowSize({
//@ts-ignore
width: window.innerWidth,
//@ts-ignore
height: window.innerHeight,
});
}
// Add event listener
//@ts-ignore
window.addEventListener("resize", handleResize);
// Call handler right away so state gets updated with initial window size
handleResize();
// Remove event listener on cleanup
//@ts-ignore
return () => window.removeEventListener("resize", handleResize);
}, []); // Empty array ensures that effect is only run on mount
return windowSize;
Expand Down

0 comments on commit 81a5ae0

Please sign in to comment.