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
reactcomponentsdomreuse
Render a shared control once in the parent, not once per list item
A single close/dismiss button that belongs to a container should live in the container, not be duplicated inside every list item.
PR: frontpage-web · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetsx
| 1 | items.map(item => ( |
| 2 | <li>{item.content}<button onClick={hide}>x</button></li> |
| 3 | )) |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | <> |
| 2 | <button onClick={hide}>x</button> |
| 3 | {items.map(item => <li>{item.content}</li>)} |
| 4 | </> |
Explanation (EN)
Objašnjenje (HR)