MCPcopy
hub / github.com/embedpdf/embed-pdf-viewer / useState

Function useState

packages/plugin-annotation/src/lib/utils/use-state.ts:12–19  ·  view source on GitHub ↗
(initialValue: T)

Source from the content-addressed store, hash-verified

10 * - A function to get the current value without causing re-renders (useful inside closures).
11 */
12export function useState<T>(initialValue: T): [() => T, (newValue: T) => void] {
13 let value = initialValue;
14 const getValue = () => value;
15 const setValue = (newValue: T) => {
16 value = newValue;
17 };
18 return [getValue, setValue];
19}

Callers 15

createFunction · 0.90
createFunction · 0.90
createFunction · 0.90
createFunction · 0.90
createFunction · 0.90
createFunction · 0.90
createFunction · 0.90
createFunction · 0.90
createFunction · 0.90
useClickDetectorFunction · 0.90
createFunction · 0.90
createFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected