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
reactdryjsx
Don't repeat an identical attribute on every item
If the same prop/value is set identically on every iteration or option, lift it out instead of writing it manually on each one.
PR: vinify-frontend · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetsx
| 1 | {opts.map(o => <Option key={o} variant="body2" data-x />)} |
| 2 | // variant identical on all |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | {opts.map(o => <Option key={o} />)} |
| 2 | // set the shared variant once on the wrapper/theme |
Explanation (EN)
Objašnjenje (HR)