globalbridge-lsf-custom
Version:
GlobalBridge in-house labeling tool, originating from LSF.
24 lines (18 loc) • 508 B
text/typescript
import { useEffect, useState } from 'react';
export const useWindowSize = () => {
const [windowSize, setWindowSize] = useState({
width: window.innerWidth,
height: window.innerWidth,
});
useEffect(() => {
const onResize = () => {
setWindowSize({
width: window.innerWidth,
height: window.innerWidth,
});
};
window.addEventListener('resize', onResize);
return () => window.removeEventListener('resize', onResize);
}, []);
return windowSize;
};