mirror of
https://github.com/outline/outline.git
synced 2026-06-27 10:14:23 +03:00
17 lines
267 B
JavaScript
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;
|