Files
outline/app/hooks/useUnmount.js
T
Tom Moor b382467a04 tweak
2021-03-30 00:31:19 -07:00

17 lines
267 B
JavaScript

// @flow
import * as React from "react";
const useUnmount = (callback: Function) => {
const ref = React.useRef(callback);
ref.current = callback;
React.useEffect(() => {
return () => {
ref.current();
};
}, []);
};
export default useUnmount;