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
reactapi-designpropsdry
Let a component accept the data shape it needs instead of remapping at the call site
Avoid reshaping data into a bespoke structure just before passing it in; design the component to consume the natural input so callers don't repeat remapping.
PR: hegnar-web · org-mining-deep-2026-06Created: Jun 17, 2026
Bad example
Old codetsx
| 1 | <Card data={articles.map((a) => ({ t: a.title, i: a.img }))} /> |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | <Card articles={articles} /> // Card reads article.title / article.img itself |
Explanation (EN)
Objašnjenje (HR)