Files
static-front/src/hooks/useIsomorphicLayoutEffect.js
T
2026-07-30 10:57:49 +04:00

12 lines
368 B
JavaScript

"use client";
import { useEffect, useLayoutEffect } from "react";
/**
* useLayoutEffect throws a warning during SSR. This swaps to a
* plain useEffect on the server so GSAP-driven components can be
* imported anywhere without triggering Next.js warnings.
*/
export const useIsomorphicLayoutEffect =
typeof window !== "undefined" ? useLayoutEffect : useEffect;