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
reactcontextpropsprop-drilling
Read shared state from context instead of prop-drilling
If a component already has access to a context, read values from it rather than threading the same props through many layers.
PR: vinify-frontend · org-mining-deep-2026-06Created: Jun 17, 2026
Bad example
Old codetsx
| 1 | <PDFReader page={page} zoom={zoom} totalPages={totalPages} onPage={...} /> |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | // PDFReader reads page/zoom/totalPages from PDFContext directly |
| 2 | const { page, zoom, totalPages } = usePdfContext(); |
Explanation (EN)
Objašnjenje (HR)