What is the purpose of the "measureElement" function? #1126
Unanswered
fabiospampinato
asked this question in
Q&A
Replies: 1 comment
-
|
@fabiospampinato the main reason is that the virtualizer needs a way to associate this specific DOM element with that specific virtual item, measure it, and keep that measurement updated over time. Passing it as a ref gives us a convenient lifecycle hook when the element mounts/unmounts. In practice measureElement does a few things:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey 👋 I don't get why we have a "measureElement" function at all that we are supposed to be passing as ref, my understanding is that when items have dynamic dimensions we should be listening for dimension changes and when they happen (the resize observer will also notify us of the initial dimensions, IIRC) we would call the "resizeItem" function.
So what is the "measureElement" doing for us? Are we trying to measure the dimensions before the resize observer notifies us? 🤔
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions