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 ruleP1universalStack: React
reactreusabilitypropscomponents
Make displayed content configurable via props, not hardcoded
Reusable components shouldn't bake in titles, names, image URLs or other content; accept them as props so the component can be reused.
PR: hegnar-components · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetsx
| 1 | const Player = () => ( |
| 2 | <> |
| 3 | <img src="https://cdn.example.com/fixed-logo.png" /> |
| 4 | <p>Audio title</p> |
| 5 | </> |
| 6 | ); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | const Player = ({ imageUrl, title }: PlayerProps) => ( |
| 2 | <> |
| 3 | <img src={imageUrl} /> |
| 4 | <p>{title}</p> |
| 5 | </> |
| 6 | ); |
Explanation (EN)
Objašnjenje (HR)