Skip to main content

useIsomorphicLayoutEffect

In the DOM environment, this hook is the same as React.useLayoutEffect. In the SSR environment, it is the same as React.useEffect.

API

function useIsomorphicLayoutEffect(
effect: React.EffectCallback,
deps?: React.DependencyList
): void;

Example

import React from "react";
import { useIsomorphicLayoutEffect } from "@lilib/hooks";

function Example() {
useIsomorphicLayoutEffect(() => {
console.log("Run effect");
});
...
}