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 ruleP2project specificStack: React + MUI
muireusecomponentsconsistency
Prefer the existing component library over a hand-rolled equivalent
Before implementing a control (toggle, button) from raw HTML, check whether the UI library (e.g. MUI) already provides it; reach for custom only when overriding it is genuinely heavier.
PR: hegnar-forum-web · org-mining-3rd-2026-06Created: Jun 18, 2026
Bad example
Old codetsx
| 1 | <div className="toggle"><button/><button/></div> // fully hand-rolled |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | import { ToggleButton, ToggleButtonGroup } from '@mui/material'; |
Explanation (EN)
Objašnjenje (HR)