-
Notifications
You must be signed in to change notification settings - Fork 44
Open
Description
Hey,
I'm kind of stuck with all dimensions being 0 on first Component render. Hot-reloading somehow magically sets the values to correct ones but that obviously won't do.
Nothing fancy here:
const [itemRef, { x }, node] = useDimensions()
useEffect(() => {
console.log(x)
}, [x])
...
return (
<Component ref={itemRef}>
{children}
</Component>
)
...
Actually the first render gets me all 'undefined' (including node), the second one comes back with 0s and node as actual HTMLElement.
Any ideas what might be the cause of this? The container element is a flex-box wrapper - I thought this might be it but then tried to run useDimensions on that element and same results came back
furkankly, Ghostavio, ryanthomas-dd and bressain
Metadata
Metadata
Assignees
Labels
No labels