react-alien-signals
    Preparing search index...

    Function useSignalValue

    • React hook that subscribes to a readable Alien Signal (either writable or computed) and returns its current value.

      Type Parameters

      • T

        The type of the signal value.

      Parameters

      Returns T

      The current value of the signal.

      const count = createSignal(0);
      const double = createComputed(() => count() * 2);
      function Display() {
      const countValue = useSignalValue(count);
      const doubleValue = useSignalValue(double);
      return <div>Count: {countValue}, Double: {doubleValue}</div>;
      }
    • React hook that subscribes to a readable Alien Signal (either writable or computed) and returns its current value.

      Type Parameters

      • T

        The type of the signal value.

      Parameters

      Returns T

      The current value of the signal.

      const count = createSignal(0);
      const double = createComputed(() => count() * 2);
      function Display() {
      const countValue = useSignalValue(count);
      const doubleValue = useSignalValue(double);
      return <div>Count: {countValue}, Double: {doubleValue}</div>;
      }