Performance: Reactive forms vs template forms decision
MEDIUM IMPACT
This affects how quickly the form renders and responds to user input, impacting interaction responsiveness and initial load time.
Reactive form using FormGroup and FormControl with explicit subscriptions to valueChanges.
Template-driven form with many two-way bindings and ngModel directives in the template.| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Template-driven form (complex) | High due to many bindings | Multiple reflows per input | Higher paint cost | [X] Bad |
| Reactive form (complex) | Controlled and minimal | Single reflow per update | Lower paint cost | [OK] Good |
| Template-driven form (simple) | Low | Minimal reflows | Low paint cost | [OK] Good |
| Reactive form (simple) | Extra setup overhead | Minimal reflows | Slightly higher paint cost | [!] OK |