0.1.32 • Published 1 year ago
@technote-space/use-unmount-ref v0.1.32
useUnmountRef
React hook to handle unmount ref.
Table of Contents
Usage
Install
yarn add @technote-space/use-unmount-ref
or
npm i @technote-space/use-unmount-ref
Use
e.g.
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 <div>
{isLoading ? 'Loading...' : 'Not loading.'}
</div>
};
Author
0.1.32
1 year ago
0.1.31
2 years ago
0.1.30
2 years ago
0.1.28
2 years ago
0.1.29
2 years ago
0.1.27
2 years ago
0.1.25
2 years ago
0.1.26
2 years ago
0.1.23
2 years ago
0.1.24
2 years ago
0.1.22
3 years ago
0.1.21
3 years ago
0.1.20
3 years ago
0.1.19
3 years ago
0.1.18
3 years ago
0.1.17
3 years ago
0.1.16
3 years ago
0.1.15
3 years ago
0.1.14
3 years ago
0.1.13
3 years ago
0.1.12
3 years ago
0.1.11
3 years ago
0.1.10
3 years ago
0.1.8
3 years ago
0.1.7
3 years ago
0.1.9
3 years ago
0.1.6
3 years ago
0.1.5
3 years ago
0.1.4
3 years ago
0.1.3
3 years ago
0.1.2
3 years ago
0.1.1
3 years ago
0.1.0
3 years ago