Skip to content
card background pattern
Level 2

Custom React Hooks

Unlock Full Course

$49.99 $24.99

Or

$24.99/Month

Refs and ResizeObserver with useMeasure

For the hook in this video, we will take a look at useRefs and create our own custom hook to measure and resize elements in our app.

Downloads

Comments

User photo avatar
Raul
Admin
3 months ago

@Spencer You could use a useEffect without dependencies, thats the way animations such as Lottie are rendered for them to be able to work

Spencer
6 months ago

When mounting a component and wanting to possibly animate it or something using this concept of useMeasure, I noticed that the first render logs out an empty state. How do you handle that or recommend dealing with that first render where the dom is setting up? If you tried to animate something right away it would animate for example to size or width of zero.

Thanks, Spencer

Something to say?

Become a Pro