FYI, useLayoutEffect gets you what you're looking for. Since it fires before repaint, you can take measurements and modify the DOM without the user seeing any layout shift.
It's a creative solution though! I always like seeing out of the box thinking on front end problems.
FYI, useLayoutEffect gets you what you're looking for. Since it fires before repaint, you can take measurements and modify the DOM without the user seeing any layout shift.
It's a creative solution though! I always like seeing out of the box thinking on front end problems.
Neat. Have you seen differences across browsers? Feels like the hard part here is more about matching browser quirks over time than about math.