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
reactlayoutjsxspacing
Wrap repeated sibling elements in a container for shared spacing
When rendering many sibling elements that share spacing/positioning, wrap them in a single container element rather than applying the same utility behavior to each one individually.
PR: frontpage-web · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetsx
| 1 | <Ad placement='a' /> |
| 2 | <Ad placement='b' /> |
| 3 | <Ad placement='c' /> |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | <div className='spacing-top spacing-bottom'> |
| 2 | <Ad placement='a' /> |
| 3 | <Ad placement='b' /> |
| 4 | <Ad placement='c' /> |
| 5 | </div> |
Explanation (EN)
Objašnjenje (HR)