Angular · Junior · Question 68 of 75
How do you update a signal based on its current value?
count = signal(0);
increment() { this.count.update((c) => c + 1); }- ✓Correct answer: With
update(fn), which receives the current value - 2With
this.count++ - 3With
this.count.value += 1
Explanation
set(value) replaces the value; update(fn) derives the new one from the old. Both notify everything that reads the signal.