cal.pub0.org/packages/lib/hooks/useIsomorphicLayoutEffect.ts

4 lines
157 B
TypeScript

import { useEffect, useLayoutEffect } from "react";
export const useIsomorphicLayoutEffect = typeof document !== "undefined" ? useLayoutEffect : useEffect;