Skip to content

Latest commit

 

History

History
23 lines (15 loc) · 379 Bytes

useLifecycles.md

File metadata and controls

23 lines (15 loc) · 379 Bytes

useLifecycles

React lifecycle hook that call mount and unmount callbacks, when component is mounted and un-mounted, respectively.

Usage

import {useLifecycles} from 'react-use';

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

Reference

useLifecycles(mount, unmount);