React hook that subscribes to a writable signal—returning its current value plus a setter function. Internally uses React's useSyncExternalStore for concurrency-safe re-renders.
useSyncExternalStore
The type of the signal value.
The writable signal.
A tuple of [currentValue, setValue].
const count = createSignal(0);function Counter() { const [value, setValue] = useSignal(count); return <button onClick={() => setValue(value + 1)}>{value}</button>;} Copy
const count = createSignal(0);function Counter() { const [value, setValue] = useSignal(count); return <button onClick={() => setValue(value + 1)}>{value}</button>;}
React hook that subscribes to a writable signal—returning its current value plus a setter function. Internally uses React's
useSyncExternalStore
for concurrency-safe re-renders.