MCPcopy
hub / github.com/QwikDev/qwik / createSignal

Function createSignal

packages/qwik/src/core/use/use-signal.ts:22–29  ·  view source on GitHub ↗
(initialState?: STATE)

Source from the content-addressed store, hash-verified

20 * @public
21 */
22export const createSignal: UseSignal = <STATE>(initialState?: STATE): Signal<STATE> => {
23 const containerState = useContainerState();
24 const value =
25 isFunction(initialState) && !isQwikComponent(initialState)
26 ? invoke(undefined, initialState as any)
27 : initialState;
28 return _createSignal(value, containerState, 0) as Signal<STATE>;
29};
30
31/**
32 * Stores a value which is retained for the lifetime of the component.

Callers 3

signals.tsxFile · 0.90
useSignalFunction · 0.85

Calls 5

useContainerStateFunction · 0.90
isFunctionFunction · 0.90
isQwikComponentFunction · 0.90
invokeFunction · 0.90
_createSignalFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…