• React hook returning [value, setValue] for a given Alien Signal. Uses useSyncExternalStore for concurrency-safe re-renders.

    Type Parameters

    • T

      The type of the signal value.

    Parameters

    • alienSignal: IWritableSignal<T>

      The signal to read/write.

    Returns [T, (val: T | (oldVal: T) => T) => void]

    A tuple [currentValue, setValue].

    const countSignal = createSignal(0);
    function Counter() {
    const [count, setCount] = useSignal(countSignal);
    return <button onClick={() => setCount(count + 1)}>{count}</button>;
    }