Merge branch 'fix-typo-drive' into 'main'
[ProtonMail-WebClient.git] / packages / hooks / useIsMounted.ts
blob6db037260bef38a6d42b82bdd0aa8a9cfdfa49c3
1 import { useCallback, useEffect, useRef } from 'react';
3 const useIsMounted = () => {
4     const ref = useRef(false);
6     useEffect(() => {
7         ref.current = true;
8         return () => {
9             ref.current = false;
10         };
11     }, []);
13     return useCallback(() => {
14         return ref.current;
15     }, []);
18 export default useIsMounted;