Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
frontend ruleP2stack specificStack: React, react-hook-form
formsreact-hook-formstate
Prefer the form library's reset over manual state clearing
To clear a form, use the library's reset function rather than manually setting dirty flags or hand-clearing fields.
PR: hegnar-zephr-components · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetypescript
| 1 | setValue('title', ''); |
| 2 | setValue('content', ''); |
| 3 | formState.isDirty = false; // manual |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | reset(); // resets values and dirty state |
Explanation (EN)
Objašnjenje (HR)