Skip to main content

What is derived state?

Derived state is state that is computed from other state, rather than being stored separately.


A simple example:

You have a list of products:

ts
products = signal<Product[]>([]);

And derived state is, for example, the filtered products:

ts
filtered = computed(() => products().filter(p => p.inStock));

You don't store filtered manually - you just say: "Take products, process it, and here's the result".


Why it's needed:

  • No data duplication
  • Everything is always current and in sync
  • No need to update manually with every change

Where it's used:

  • computed() in signals
  • map()/combineLatest() in RxJS
  • selectors in NgRx

Conclusion: Derived state is "smart" state that doesn't live on its own, but automatically follows the underlying data. You don't manage it manually - it just "happens".

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.