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 ruleP2universalStack: React
reacthandlerssimplicity
Avoid calling multiple handlers when one would do
If a UI action triggers several handlers in sequence, consider whether they can be merged into a single handler to reduce coupling and surprises.
PR: vinify-frontend · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codets
| 1 | const onContinue = () => { |
| 2 | dispatch(setStatus(PENDING)); |
| 3 | handleSubmit(); |
| 4 | handleNextStep(); |
| 5 | }; |
Explanation (EN)
Objašnjenje (HR)
Good example
New codets
| 1 | const onContinue = () => { |
| 2 | // one cohesive handler that owns the whole transition |
| 3 | submitAndAdvance(); |
| 4 | }; |
Explanation (EN)
Objašnjenje (HR)