MCPcopy
hub / github.com/preactjs/preact / useState

Function useState

hooks/src/index.js:169–172  ·  view source on GitHub ↗
(initialState)

Source from the content-addressed store, hash-verified

167 * @returns {[S, (state: S) => void]}
168 */
169export function useState(initialState) {
170 currentHook = 1;
171 return useReducer(invokeOrReturn, initialState);
172}
173
174/**
175 * @template {unknown} S

Callers 15

ContainerFunction · 0.90
useSyncExternalStoreFunction · 0.90
StateContainerFunction · 0.90
CounterButtonFunction · 0.90
CounterFunction · 0.90
ButtonFunction · 0.90
WorkingWidgetFunction · 0.90
EditableFunction · 0.90
componentWillMountMethod · 0.90
fnFunction · 0.90
FooFunction · 0.90
TestComponentFunction · 0.90

Calls 1

useReducerFunction · 0.85

Tested by 15

ContainerFunction · 0.72
StateContainerFunction · 0.72
CounterButtonFunction · 0.72
CounterFunction · 0.72
ButtonFunction · 0.72
WorkingWidgetFunction · 0.72
EditableFunction · 0.72
componentWillMountMethod · 0.72
fnFunction · 0.72
FooFunction · 0.72
TestComponentFunction · 0.72
HookAppFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…