Ok it all makes sense now. I’d forgotten about useLayoutEffect. Haven’t had to write much react recently.