Skip to main content

useOnce

Run effect synchronously only once.

API

function useOnce(effect: () => void): void;

Example

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

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