MCPcopy
hub / github.com/streamich/react-use / resolveHookState

Function resolveHookState

src/misc/hookState.ts:18–27  ·  view source on GitHub ↗
(
  nextState: IHookStateResolvable<S>,
  currentState?: C
)

Source from the content-addressed store, hash-verified

16 currentState?: C
17): S;
18export function resolveHookState<S, C extends S>(
19 nextState: IHookStateResolvable<S>,
20 currentState?: C
21): S {
22 if (typeof nextState === 'function') {
23 return nextState.length ? (nextState as Function)(currentState) : (nextState as Function)();
24 }
25
26 return nextState;
27}

Callers 7

useCounterFunction · 0.90
setFunction · 0.90
useStateWithHistoryFunction · 0.90
useListFunction · 0.90
useGetSetFunction · 0.90
setStateFunction · 0.90
hookState.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…