← React Intermediate Questions - Set 3 Q24

What is the `useLayoutEffect` hook in React?

React Intermediate Questions - Set 3

Example

useLayoutEffect(() => {
  const h = box.current.getBoundingClientRect().height;
  setHeight(h);   // applied before the browser paints
}, []);

What to notice

← Back to the question list