Sale

The past few weeks have brought a lot of change all over the world. Here at Level Up, we hope you're taking appropriate actions to protect yourself and those around you from the spread of COVID-19. Because many of you are stuck at home, we've put all courses and the yearly subscription (Level Up Pro) 50% off until you unsubscribe.
Stay safe. - Scott Tolinski

Save 50%

$12/month*

*Paid annually

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

Spencer
about 1 month 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