()
| 1 | import { useRef, useEffect, useCallback } from "react"; |
| 2 | |
| 3 | export function useIsMounted(): () => boolean { |
| 4 | const ref = useRef(false); |
| 5 | |
| 6 | useEffect(() => { |
| 7 | ref.current = true; |
| 8 | return () => { |
| 9 | ref.current = false; |
| 10 | }; |
| 11 | }, []); |
| 12 | |
| 13 | return useCallback(() => ref.current, [ref]); |
| 14 | } |
nothing calls this directly
no outgoing calls
no test coverage detected