Function createEffect

  • Creates a side effect in Alien Signals.

    Type Parameters

    • T

      The type of the effect value.

    Parameters

    • fn: () => T

      A function that will run whenever its tracked signals update.

    Returns Effect<T>

    The created effect object.

    const countSignal = createSignal(1);
    createEffect(() => {
    console.log('Count is', countSignal.get());
    });