Package Responsive: useParentSize
is not updating the width and height
#1816
Labels
useParentSize
is not updating the width and height
#1816
Hi, I tried using the
useParentSize
hook. The width and height are always 0 when I resize the parent container.After looking at the source code, I believe we should add
parentRef.current
to the dependency array for thisuseEffect
hook:visx/packages/visx-responsive/src/hooks/useParentSize.ts
Lines 64 to 83 in 86a851c
Because the
parentRef
is initially null, soobserver.observe(parentRef.current);
is never executed, even ifparentRef
is set to the element after initial render.The text was updated successfully, but these errors were encountered: