react-use/docs/useMount.md
2019-04-01 08:39:59 +11:00

347 B

useMount

React lifecycle hook that calls a function after the component is mounted. Use useEffectOnce if you need both a mount and unmount function.

Usage

import {useMount} from 'react-use';

const Demo = () => {
  useMount(() => console.log('MOUNTED'));
  return null;
};

Reference

useMount(fn: () => void);