feat: auto proxy layout column

This commit is contained in:
GyDi
2022-12-14 15:07:51 +08:00
parent 173f35487e
commit 024db4358b
6 changed files with 69 additions and 40 deletions

View File

@@ -0,0 +1,16 @@
import { useEffect, useState } from "react";
export const useWindowWidth = () => {
const [width, setWidth] = useState(() => document.body.clientWidth);
useEffect(() => {
const handleResize = () => setWidth(document.body.clientWidth);
window.addEventListener("resize", handleResize);
return () => {
window.removeEventListener("resize", handleResize);
};
}, []);
return { width };
};