mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 10:03:33 -06:00
13 lines
258 B
TypeScript
13 lines
258 B
TypeScript
|
import { useRef, useEffect } from 'react';
|
||
|
|
||
|
export const useRefMounted = () => {
|
||
|
const refMounted = useRef(false);
|
||
|
useEffect(() => {
|
||
|
refMounted.current = true;
|
||
|
return () => {
|
||
|
refMounted.current = false;
|
||
|
};
|
||
|
});
|
||
|
return refMounted;
|
||
|
};
|