useUnmountedRef
It returns a ref object that used to determine whether the component is unmounted.
API
function useUnmountedRef(): React.MutableRefObject<boolean>;
Example
import React from "react";
import { useUnmountedRef } from "@lilib/hooks";
function Example() {
const unmountedRef = useUnmountedRef();
if (unmountedRef.current) {
// Do something.
}
...
}