When to use effect and untracked in a signal based application?
TechnicalAngular DeveloperSenior Angular DeveloperFrontend Angular developerI use effect when I need to perform side effects in response to changes in signals, like fetching data or updating the DOM. For example, if a user updates their profile, I’d use an effect to trigger a save operation.
On the other hand, I use untracked for computations that shouldn't trigger re-renders or updates, like calculating a derived value that depends on multiple signals but should remain static unless explicitly changed. This helps improve performance by avoiding unnecessary updates.