React hook that returns only a setter function for a writable signal. This is similar to Jotai's useSetAtom and can be helpful when you only need to update state.
useSetAtom
The type of the signal value.
The writable signal.
A setter function to update the signal.
const count = createSignal(0);function IncrementButton() { const setCount = useSetSignal(count); return <button onClick={() => setCount((c) => c + 1)}>+1</button>;} Copy
const count = createSignal(0);function IncrementButton() { const setCount = useSetSignal(count); return <button onClick={() => setCount((c) => c + 1)}>+1</button>;}
React hook that returns only a setter function for a writable signal. This is similar to Jotai's
useSetAtom
and can be helpful when you only need to update state.