Function createComputed

  • Creates a computed Alien Signal based on a getter function.

    Type Parameters

    • T

      The type of the computed value.

    Parameters

    • fn: () => T

      A getter function returning a computed value.

    Returns ISignal<T>

    The created computed signal.

    const countSignal = createSignal(1);
    const doubleSignal = createComputed(() => countSignal.get() * 2);