DEMO

useMount

Run a function when a component is mounted.

Usage

import { useMount } from '@react-hooks-library/core'

function Demo() {
  useMount(() => {
    alert('I have been mounted')
  })

  return <div></div>
}

Type Declarations

/**
 * Run a function when a component is mounted.
 *
 * @param callback function to be executed
 */
declare function useMount(callback: Fn): void;

Source

Source | Demo | Docs