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 ruleP1stack specificStack: react
reactpropsdata-modellingsimplicity
Don't pass props that can be derived from existing state
If a flag can be computed from data you already receive, drop the redundant prop and derive it, which simplifies rendering and fetching logic.
PR: hegnar-zephr-components · org-mining-2026-06Created: Jun 17, 2026
Bad example
Old codetsx
| 1 | <Widget isAnonymous={isAnonymous} status={status} /> |
| 2 | // status is already 'anonymous' whenever isAnonymous is true |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | <Widget status={status} /> |
| 2 | // derive: const isAnonymous = status === 'anonymous'; |
Explanation (EN)
Objašnjenje (HR)