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
| Parameter | Type | Description | Default |
|---|---|---|---|
effect | Function | The effect function to be executed. | - |
[dependencies] | Array<any> | An array of dependencies for the effect (optional). | - |
Return Value
| Value | Type | Description |
|---|---|---|
return | unknown | Value returned by the hook. |