MCPcopy Create free account
hub / github.com/triggerdotdev/jsonhero-web / useIsMounted

Function useIsMounted

app/hooks/useIsMounted.tsx:3–14  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1import { useRef, useEffect, useCallback } from "react";
2
3export 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}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected