Rules Hub
Code Ruleset
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Use a single state class rather than duplicating active and selected variants
Avoid maintaining two near-identical state classes/props when one expressive class suffices; collapse redundant active/selected duplication.
Bad example
| 1 | c += ` ${css.active} active`; |
| 2 | c += ` ${css.selected} selected`; |
Explanation (EN)
Two mutable names for the same verified state create unnecessary synchronization paths.
Objašnjenje (HR)
Good example
| 1 | c += ` ${css.selected}`; // one state class is enough |
Explanation (EN)
Objašnjenje (HR)
Notes (EN)
Trace every CSS, JavaScript and external consumer before combining state classes, and establish that active and selected represent the same lifecycle fact.
Exceptions / Tradeoffs (EN)
Active interaction, selected item, focus and pressed state can be distinct. Global classes may be public integration hooks even when a CSS module appears equivalent.