useIsomorphicLayoutEffect

Custom hook that uses either `useLayoutEffect` or `useEffect` based on the environment (client-side or server-side).

Custom hook that uses either useLayoutEffect or useEffect based on the environment (client-side or server-side).

Usage

import { useIsomorphicLayoutEffect } from "@tilt-legal/cubitt-components/utilities/hooks";

useIsomorphicLayoutEffect(() => {
  // Code to be executed during the layout phase on the client side
}, [dependency1, dependency2]);

API

Signature

declare const useIsomorphicLayoutEffect: typeof useLayoutEffect;

Parameters

ParameterTypeDescriptionDefault
effectFunctionThe effect function to be executed.-
[dependencies]Array<any>An array of dependencies for the effect (optional).-

Return Value

ValueTypeDescription
returnunknownValue returned by the hook.

On this page