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
reactcompositionreusecomponents
Separate reusable wrappers (Popup) from feature content
Keep generic shell concerns (visibility, close) in a reusable Popup wrapper and pass feature content as children, so the popup can be reused without re-implementing it.
PR: frontpage-web · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetsx
| 1 | // ProgramDetails contains its own overlay + slider + close logic |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | <Popup isVisible={v} onClose={c}> |
| 2 | <ProgramDetails onSlideChange={s} /> |
| 3 | </Popup> |
Explanation (EN)
Objašnjenje (HR)