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
reactmodalscompositionduplication
Don't wrap a view in a modal component when the parent already is the modal
A view rendered inside a modal shouldn't itself render the modal wrapper; let the parent own the modal so styling and behavior aren't doubled.
PR: hegnar-zephr-components · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetsx
| 1 | const EnterEmailModal = () => ( |
| 2 | <ModalRendered> |
| 3 | <EmailForm /> |
| 4 | </ModalRendered> |
| 5 | ); // but this is rendered inside another ModalRendered |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | const EnterEmailView = () => <EmailForm />; // parent owns ModalRendered |
Explanation (EN)
Objašnjenje (HR)