@xo-union/tk-component-header-nav
Version:
11 lines (9 loc) • 396 B
JavaScript
import { useLayoutEffect, useEffect } from "react";
/*
If rendered in the server (SSR) useLayoutEffect will fall back to useEffect
*/
const useIsomorphicLayoutEffect =
// eslint-disable-next-line no-restricted-globals
typeof window !== 'undefined' ? useLayoutEffect : useEffect;
// Ensure the name used in components is useLayoutEffect
export { useIsomorphicLayoutEffect as useLayoutEffect };