Function useSignalValue

  • React hook returning only the current value of an Alien Signal (or computed). No setter is provided.

    Type Parameters

    • T

      The type of the signal value.

    Parameters

    • alienSignal: IWritableSignal<T>

      The signal to read.

    Returns T

    The current value.

    const countSignal = createSignal(0);
    const doubleSignal = createComputed(() => countSignal.get() * 2);
    function Display() {
    const count = useSignalValue(countSignal);
    const double = useSignalValue(doubleSignal);
    return <div>{count}, {double}</div>;
    }