I need to make useWindowHook to check the sizes of the screen. I cannot store sizes by default as {width: document.body.clientWidth, height: document.body.clientHeight} because it is not seeing document object. So the first return is {width: 0, height: 0}, and the functionality of some components lagging for 1 second. How can I fix it?
`import {$, useOnWindow, useStore} from "@builder.io/qwik";
export const useWindowSize = () => {
const sizes = useStore({width: 0, height: 0});
useOnWindow(
['load', 'resize'],
$(() => {
sizes.width = document.body.clientWidth;
sizes.height = document.body.clientHeight;
})
);
return sizes;
}`