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 ruleP1universalStack: React
reactside-effectsanti-pattern
Don't reassign shared singletons on every render
Assigning a value into a shared/static object during render runs on every render and is a code smell; resolve the dependency where it actually belongs.
PR: vinify-frontend · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetsx
| 1 | const Form = () => { |
| 2 | const i18n = useTranslations(); |
| 3 | StaticTranslations.i18n = i18n; // runs every render |
| 4 | return <form />; |
| 5 | }; |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | // inject the dependency where it is actually needed, not via a render-time global mutation |
Explanation (EN)
Objašnjenje (HR)