react-use/docs/useUnmount.md
2019-03-31 20:02:50 +11:00

303 B

useUnmount

React lifecycle hook that calls a function when the component will unmount.

Usage

import {useUnmount} from 'react-use';

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

Reference

useUnmount(fn: () => void | undefined);