@shopify/polaris
Version:
Shopify’s product component library
19 lines (18 loc) • 599 B
TypeScript
import { EffectCallback } from '../types';
/**
* Similarly to the life-cycle method componentDidMount, useComponentDidMount
* will be invoked after the component has mounted, and only the initial mount.
* @param callback Defines a callback to invoke once the component has
* initially mounted.
* @example
* function Playground({active}) {
* useComponentDidMount(() => {
* if (active) {
* console.warning(`Component has mounted.`);
* }
* });
*
* return null;
* }
*/
export declare function useComponentDidMount(callback: EffectCallback): void | (() => void | undefined);