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
reactcss-modulesreuseclean-code
Reuse a component's CSS module classes instead of wrapping in a new component
To apply existing typography/styles to a plain tag, import and apply the relevant CSS module classes directly rather than introducing an extra wrapper component that changes the tag.
PR: hegnar-zephr-components · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetsx
| 1 | // wrapping just to get typography styles, also changes <p> to <span> |
| 2 | <Typography variant="title">Forum</Typography> |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | import typography from 'components/Typography/Typography.module.scss'; |
| 2 | <p className={typography.title}>Forum</p> |
Explanation (EN)
Objašnjenje (HR)