refactor: polish

This commit is contained in:
2024-09-20 22:15:12 +01:00
parent 4b3e7710e0
commit c274c0a842
39 changed files with 419 additions and 320 deletions

View File

@ -0,0 +1,20 @@
import { useEffect, useState } from "react";
export default function useWindowSize() {
const [dims, setDims] = useState({
width: window.innerWidth,
height: window.innerHeight,
});
useEffect(() => {
const handler = () => {
setDims({
width: window.innerWidth,
height: window.innerHeight,
});
};
window.addEventListener("resize", handler);
return () => window.removeEventListener("resize", handler);
}, []);
return dims;
}