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
reusesuspensecomponentsdry
Use a wrapper component to share JSX between content and Suspense fallback
Extract the shared header/skeleton into small components and a wrapper so the same markup feeds both the rendered content and the Suspense fallback, shrinking the diff and matching UX.
PR: hegnar-bellsheep-web · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetsx
| 1 | // header markup duplicated in the component and again in the Suspense fallback |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | function InventoryWrapper(props) { |
| 2 | return <Suspense fallback={<Inventory {...props} />}><Await resolve={props.data.inventory}><Inventory {...props} /></Await></Suspense>; |
| 3 | } |
Explanation (EN)
Objašnjenje (HR)