Suggest an editImprove this articleRefine the answer for “What is effect() in Angular?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)**`effect()`** is a way to react to signal changes. When a signal changes, the code inside `effect()` runs automatically. **Key point:** `effect()` tracks on its own which signals it reads, and re-runs the code when they change, returning nothing, only reacting.Shown above the full answer for quick recall.Answer (EN)Image`effect()` is a way to **react to signal changes**. When a signal changes, the code inside `effect()` runs automatically. ### Example: ```ts import { signal, effect } from '@angular/core'; const counter = signal(0); effect(() => { console.log('New value:', counter()); }); ``` If you call `counter.set(5)`, the console will show `New value: 5`. ### Why it is needed `effect()` is used for **side effects** that are not directly tied to the template: - logging, - server requests, - writing data to localStorage, - updating the DOM outside Angular. ### The main point: - `effect()` tracks on its own which signals it reads; - it re-runs the code when they change; - it returns nothing, it simply *reacts*.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.