Effects
Introduction
Section titled “Introduction”Effects run side effects when signal dependencies change — like console.log, localStorage, or analytics.
Example
Section titled “Example”effect(() => { console.log(`Count changed to: ${this.count()}`); // Runs automatically when count() changes});
// With cleanupeffect((onCleanup) => { const subscription = someObservable$.subscribe(v => console.log(v)); onCleanup(() => subscription.unsubscribe());});Summary
Section titled “Summary”Effects handle side effects triggered by signal changes.”