You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

12 lines
258 B

import { useRef, useEffect } from 'react';
export const useRefMounted = () => {
const refMounted = useRef(false);
useEffect(() => {
refMounted.current = true;
return () => {
refMounted.current = false;
};
});
return refMounted;
};