React useIsomporphicEffect hook
Eesolves to useEffect()
on the server and useLayoutEffect()
on the client.
- Use
typeof
to check if theWindow
object is defined. If it is, return theuseLayoutEffect()
. Otherwise returnuseEffect()
.
Eesolves to useEffect()
on the server and useLayoutEffect()
on the client.
typeof
to check if the Window
object is defined. If it is, return the useLayoutEffect()
. Otherwise return useEffect()
.