mirror of
https://github.com/streamich/react-use.git
synced 2026-01-18 14:06:52 +00:00
Refactor useUnmount
This commit is contained in:
parent
236373bbed
commit
5284c8a4be
@ -1,9 +1,7 @@
|
||||
import {useEffect} from 'react';
|
||||
import useEffectOnce from './useEffectOnce'
|
||||
|
||||
const useUnmount = (unmount) => {
|
||||
useEffect(() => () => {
|
||||
if (unmount) unmount();
|
||||
}, []);
|
||||
const useUnmount = (fn: () => void | undefined) => {
|
||||
useEffectOnce(() => fn);
|
||||
};
|
||||
|
||||
export default useUnmount;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user