For those copying/getting inspired by the code, don't forget to add the missing empty-array for the useLayoutEffet dependency param.
You need to run it without the dependency array or add all layout-changing props and state to it.
For those copying/getting inspired by the code, don't forget to add the missing empty-array for the useLayoutEffet dependency param.