useIsomorphicLayoutEffect()

description

  • It switches between useEffect and useLayoutEffect depending on the execution environment.

code

export const useIsomorphicLayoutEffect =
typeof document !== "undefined" ? useLayoutEffect : useEffect;