effect
A reactive side effect that automatically runs when dependencies change.
import { signal, effect } from '@hellajs/core';
const count = signal(0);
// Creates an effect that runs when count changesconst cleanup = effect(() => { console.log(`The count is: ${count()}`);});// Logs: "The count is: 0" (initial run)
count(1);// Logs: "The count is: 1"
// Stop the effect from runningcleanup();
// No longer logs anythingcount(2);