UNPKG

@linzjs/step-ag-grid

Version:

[![semantic-release: angular](https://img.shields.io/badge/semantic--release-angular-e10079?logo=semantic-release)](https://github.com/semantic-release/semantic-release) > Reusable [ag-grid](https://www.ag-grid.com/) component for LINZ / Toitū te whenua.

19 lines (17 loc) 743 B
import { useEffect, useLayoutEffect } from 'react'; /** * Copied from usehooks-ts * * Custom hook that uses either `useLayoutEffect` or `useEffect` based on the environment (client-side or server-side). * @param {Function} effect - The effect function to be executed. * @param {Array<any>} [dependencies] - An array of dependencies for the effect (optional). * @public * @see [Documentation](https://usehooks-ts.com/react-hook/use-isomorphic-layout-effect) * @example * ```tsx * useIsomorphicLayoutEffect(() => { * // Code to be executed during the layout phase on the client side * }, [dependency1, dependency2]); * ``` */ export const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;