-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
All dimensions returned as 0 #29
Comments
I don't know the actual reason behind this but as I was trying to debug this problem, I've realized even though the The measure function It's not recommended to store the ref (the actual node) in a state as But whole point of using callback refs is to have more control over the refs we create, so we actually make these refs our part of the data flow by using At this point, I just wanted to make sure I'm getting the dimensions of the "final version" of the node in the initial render so I wanted to give some time to async
and it worked. (Not to mention about the performance but this addition feels quite hacky...) |
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:
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
The text was updated successfully, but these errors were encountered: