Stop Misusing Effects! Linked Signals Are the Better Alternative!

State synchronization with Angulars brand new linked Singlas API for a cleaner and more maintainable approach.

emoji_objects emoji_objects emoji_objects
Kevin Kreuzer

Kevin Kreuzer

@kreuzercode

10.02.2025

4 min read

Stop Misusing Effects! Linked Signals Are the Better Alternative!
share

With Angular’s renaissance and the rise of new reactive state management tools like Signals and Effects, developers often turn to Effects for state synchronization.

While Effects have their place, they are not primarily designed to keep state in sync, and relying on them for this purpose can lead to unnecessary complexity.

Angular 19 introduces linked Signals, a powerful addition to the framework’s reactive toolkit that provides a cleaner alternative to managing state. Unlike computed signals, which only derive values reactively, linked Signals offer writable state — allowing manual updates when needed while maintaining reactivity.

In this post, we’ll explore why Effects can be an anti-pattern, how linked Signals provide a more maintainable approach, and how you can use them to improve your Angular apps. 😉

The Challenge of state synchronization

Let’s take a common example: A ProductChooserComponent that allows users to select a product and specify a quantity. Here’s a screenshot of such an application.

Product chooser demo application

Clicking the plus button triggers the addProduct function, adding a new product. The total updates automatically whenever an item is added or removed.

export class ProductCardComponent {
  product = input.required<Product>();
  amount = signal(1);
  total = computed(() => this.amount() * this.product().total);
  
  nextProduct = output<void>();
  previousProduct = output<void>();

  addProduct() {
    this.amount.update(v => v + 1);
  }

  removeProduct() {
    this.amount.update(v => v - 1);
  }
}

The ProductCardComponent is a reusable component, meaning it accepts a product as input. If we switch the product — using an Angular output in the template to emit nextProduct or previousProduct — only the product updates, while the amount remains unchanged.

In other words, If a user adds 4 items of one product and then selects another, the amount remains at 4 instead of resetting. This results in unintended behavior. We need a way to ensure the amount updates in sync with the new product.

The Wrong Approach: Misusing Effects

One way to address this is to use an effect to reset the amount when the product changes:

#resetAmountEffect = effect(() => {
  this.product();
  this.amount.set(1);
});

While this works, it misuses Effects for state management. The issues with this approach include:

Misuse of Effects: Effects are meant for handling side Effects (e.g., API calls, external updates), not for deriving or managing state.
Separation of Concerns: Using Effects for state derivation blurs concerns, making the code harder to maintain and understand.
⚠️ Potential for Glitches: Since Effects run asynchronously, they introduce a risk of inconsistent states, which can lead to unexpected behavior.

The Better Solution: linked Signals ✅

Instead of an effect, we can use the new linked signal API, which is designed for state synchronization. Let’s refactor our component.

export class ProductCardComponent {
  product = input.required<Product>();
  amount = linkedSignal({
    source: this.product,
    computation: () => 1,
  });

  addProduct() {
    this.amount.update(v => v + 1);
  }

  removeProduct() {
    this.amount.update(v => v - 1);
  }
}

With this approach, the amount automatically resets when the product changes, while still allowing updates when adding or removing a product.

Immediate updates: No async execution delays or glitches.
Cleaner code: Avoiding unintended side Effects that disrupt state management.

By using linked Signals, we eliminate the effect entirely and simplify the logic while achieving the same behavior.

Beyond the Basics

The example above is just a glimpse of what’s possible with linked Signals. Want to explore more? Want to dive deeper into the linked Signals API? Check out our brand-new Angular Signals Masterclass eBook, where we dive into topics such as:

  • More complex computation functions that rely on both source and previous values.

  • Using linked Signals for client-side updates of fetched data to implement optimistic vs. pessimistic updates.

If you’re serious about writing modern, reactive, and maintainable Angular applications, mastering Signals is a must. This book covers everything you need to know — from why Signals matter to linked Signals and the roadmap ahead.

TL;DR

✅ Linked Signals allow you to derive state from a source signal while keeping it writable.
✅ Linked Signals eliminate the need for Effects when synchronizing state.
✅ Linked Signals simplify state management for dynamic UI interactions.
✅ Stop using Effects for state updates — use linked Signals instead!

Let me know what you think in the comments! Have you tried linked Signals yet? How are you using them in your Angular apps? 🔥

Do you enjoy the theme of the code preview? Explore our brand new theme plugin

Skol - the ultimate IDE theme

Skol - the ultimate IDE theme

Northern lights feeling straight to your IDE. A simple but powerful dark theme that looks great and relaxes your eyes.

Prepare yourself for the future of Angular and become an Angular Signals expert today!

Angular Signals Mastercalss eBook

Angular Signals Mastercalss eBook

Discover why Angular Signals are essential, explore their versatile API, and unlock the secrets of their inner workings.

Elevate your development skills and prepare yourself for the future of Angular. Get ahead today!

Get notified
about new blog posts

Sign up for Angular Experts Content Updates & News and you'll get notified whenever I release a new article about Angular, Ngrx, RxJs or other interesting Frontend topics!

We will never share your email with anyone else and you can unsubscribe at any time!

Emails may include additional promotional content, for more details see our Privacy policy.

Responses & comments

Do not hesitate to ask questions and share your own experience and perspective with the topic

Nivek - GDE for Angular & Web Technologies

Nivek

GDE for Angular & Web Technologies

Trainer, Berater und Senior Front-End Engineer mit Schwerpunkt auf dem modernen Web. Er ist sehr erfahren in der Implementierung, Wartung und Verbesserung von Anwendungen und Kernbibliotheken für große Unternehmen.

Kevin ist ständig dabei, sein Wissen zu erweitern und zu teilen. Er unterhält mehrere Open-Source-Projekte, unterrichtet moderne Webtechnologie in Workshops, Podcasts, Videos und Artikeln. Weiter ist er ein beliebter Referent auf Konferenzen. Er schreibt für verschiedene Tech-Publikationen und war 2019 der aktivste Autor der beliebten Angular In-Depth Publikation.

58

Blog posts

2M+

Blog views

39

NPM packages

4M+

Downloaded packages

100+

Videos

15

Celebrated Champions League titles

You might also like

Check out following blog posts from Angular Experts to learn even more about related topics like Modern Angular !

Stärken Sie Ihr Team mit unserer umfassenden Erfahrung

Unsere Angular Experten haben viele Jahre damit verbracht, Unternehmen und Startups zu beraten, Workshops und Tutorials zu leiten und umfangreiche Open-Source-Ressourcen zu pflegen. Wir sind sehr stolz auf unsere Erfahrung im Bereich des modernen Frontends und würden uns freuen auch Ihrem Unternehmen zum Aufschwung zu verhelfen.

or