React sensor hook that tracks dimensions of the browser window.
import {useWindowSize} from 'react-use';
const Demo = () => {
const {width, height} = useWindowSize();
return (
<div>
<div>width: {width}</div>
<div>height: {height}</div>
</div>
);
};useWindowSize(options);initialWidthβ Initial width value for non-browser environments.initialHeightβ Initial height value for non-browser environments.onChangeβ Callback function triggered when the window size changes.