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
reactcomponent-designenumsingle-responsibility
Drive a presentational component's variants from a state enum, not loose strings
Instead of passing several free-form text/url props, expose a state enum and let the component resolve its own copy and links per state.
PR: hegnar-components · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetypescript
| 1 | <WatchlistPrompt text="..." buttonText="..." url="..." /> |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | enum WatchlistPromptState { LoggedOut, NoItems } |
| 2 | <WatchlistPrompt state={WatchlistPromptState.LoggedOut} /> |
Explanation (EN)
Objašnjenje (HR)