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
reactjsxclean-codemarkup
Avoid redundant wrapper elements by passing classes to the inner component
Instead of wrapping a component in an extra div just for a class, pass the className to the component directly.
PR: hegnar-web · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetsx
| 1 | <div className="c-currency-page"> |
| 2 | <ClientComponent> |
| 3 | <MillistreamComponent id="currency-list" /> |
| 4 | </ClientComponent> |
| 5 | </div> |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | <ClientComponent className="c-currency-page"> |
| 2 | <MillistreamComponent id="currency-list" /> |
| 3 | </ClientComponent> |
Explanation (EN)
Objašnjenje (HR)