MCPcopy Create free account
hub / github.com/modelcontextprotocol/inspector / useCopy

Function useCopy

client/src/lib/hooks/useCopy.ts:9–27  ·  view source on GitHub ↗
({ timeout = 500 }: UseCopyProps = {})

Source from the content-addressed store, hash-verified

7};
8
9function useCopy({ timeout = 500 }: UseCopyProps = {}) {
10 const [copied, setCopied] = useState(false);
11
12 useEffect(() => {
13 let timeoutId: NodeJS.Timeout;
14 if (copied) {
15 timeoutId = setTimeout(() => {
16 setCopied(false);
17 }, timeout);
18 }
19 return () => {
20 if (timeoutId) {
21 clearTimeout(timeoutId);
22 }
23 };
24 }, [copied, timeout]);
25
26 return { copied, setCopied };
27}
28
29export default useCopy;

Callers 2

ToolsTabFunction · 0.85
JsonView.tsxFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected