useIsomorphicLayoutEffect
A hook that uses `useLayoutEffect` on the client and `useEffect` on the server.
Installation
npx atmx add hook use-isomorphic-layout-effect
Copy and paste the following method into @/utils/helpers/undefined.ts
:
import * as React from "react";
import { isBrowser } from "@/helpers/is-browser.ts";
/*** A hook that uses `useLayoutEffect` on the client and `useEffect` on the server.*/export const useIsomorphicLayoutEffect = isBrowser()? React.useLayoutEffect: React.useEffect;