Creates a WriteableSignal similar to array.reduce: Every time a value is set, callbackFn is run with the previous value to create a new value.

The signal's initial value

The callback run when the signal is set that will create its value

The equality function that will run after callbackFn

A writable signal whose output value is run through the callbackFn.

const accumulateValue = reduceSignal(1, (prior, cur) => prior + cur);
console.log(accumulateValue()); // 1
accumulateValue.set(5);
console.log(accumulateValue()); // 6
accumulateValue.update(x => x + 1);
console.log(accumulateValue()); // 13