UNPKG

599 BTypeScriptView Raw
1import { EffectCallback } from '../types';
2/**
3 * Similarly to the life-cycle method componentDidMount, useComponentDidMount
4 * will be invoked after the component has mounted, and only the initial mount.
5 * @param callback Defines a callback to invoke once the component has
6 * initially mounted.
7 * @example
8 * function Playground({active}) {
9 * useComponentDidMount(() => {
10 * if (active) {
11 * console.warning(`Component has mounted.`);
12 * }
13 * });
14 *
15 * return null;
16 * }
17 */
18export declare function useComponentDidMount(callback: EffectCallback): void | (() => void | undefined);