What you will learn
Model local reactive state with signals and derive values without duplication.
- signal creates writable state. Read its value by calling it, set a replacement with set, and calculate from the previous value with update.
- computed creates read-only derived state and tracks the signals read during its calculation. Totals, filtered records, and validation summaries are good computed values.
- effect is for synchronizing with something outside the reactive model, such as logging or a browser API. Do not use an effect to copy one signal into another.
- Replace arrays and objects when updating them so the change is explicit and predictable.
How it works
1Event updates signal
2computed invalidates
3Template reads values
4Angular updates consumers
Expected result
Each click increases Notebook quantity, item count, and total without storing duplicate totals.
Common mistakes
Do not read a signal without parentheses. Do not mutate the existing array with push. Do not use effect to propagate derived state.
