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
reactstateerror-handling
Store a boolean error flag when you only need to know it failed
If the UI only cares whether an error happened, set a boolean rather than stashing the error object.
PR: hegnar-web · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetypescript
| 1 | catch (err) { |
| 2 | setError(err); |
| 3 | } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | catch (err) { |
| 2 | setError(true); |
| 3 | } |
Explanation (EN)
Objašnjenje (HR)