There are two React hooks, useEffect and useLayoutEffect, that appear to work pretty much the same. The way you call them even looks the same. useEffect(() => { // do side effects return () => /* cleanup */ }, [dependency, array]); useLayoutEffect(() => { // do side effects return () => /* cleanup */ }, [dependency, array]); But they’re not quite the same. Read on for what makes them different and
![When to useLayoutEffect Instead of useEffect (example)](https://cdn-ak-scissors.b.st-hatena.com/image/square/c2e7f911f601e110e42c3d61ef70a4bd22b6083d/height=288;version=1;width=512/https%3A%2F%2Fdaveceddia.com%2Fimages%2Fuseeffect-vs-uselayouteffect.png)