Closed oscarsidebo closed 3 years ago
I would compose the hook into a component, because as opposed to hooks, components can be rendered conditionally. Then I'd map the set of elements to a set of these components, and aggregate the result from their onResize callback.
Hope that helps.
That worked, thanks
👌
On Mon, 8 Feb 2021, 00:05 oscarsidebo, notifications@github.com wrote:
That worked, thanks
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ZeeCoder/use-resize-observer/issues/60#issuecomment-774784692, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4CKEWC2JG7A2TMRHVMT7DS54MCFANCNFSM4XHBWANA .
I'm rendering an array of elements and need to capture the width of each element individually.
This hook works perfectly for a single element but is there a way to capture the sizes of a dynamic amount of elements?
I saw the example of reusing the hook by passing in custom refs but that example requires you to create all refs up front which wouldn't be possible with a dynamic amount of elements.
Any advice 🙏?