React hook to handle unmount ref.
npm install @technote-space/use-unmount-ref




React hook to handle unmount ref.
Details
- Usage
- Install
- Use
- Author
yarn add @technote-space/use-unmount-refor
npm i @technote-space/use-unmount-ref
e.g.
``tsx
import type { FC } from 'react';
import { useEffect, useState } from 'react';
import useUnmountRef from '@technote-space/use-unmount-ref';
const TestPage: FC = () => {
const unmountRef = useUnmountRef();
const [isLoading, setIsLoading] = useState(false);
useEffect(() => {
setIsLoading(true);
setTimeout(() => {
if(!unmountRef.current) {
setIsLoading(false);
}
}, 1000);
}, []);
return