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
reacthooksabstractionsimplification
Inline a wrapper hook that adds no value
If a hook just calls two other hooks without adding logic, call those directly in the consumer instead of keeping the wrapper.
PR: hegnar-forum-web · org-mining-3rd-2026-06Created: Jun 18, 2026
Bad example
Old codets
| 1 | const useBootstrapState = () => { |
| 2 | useSession(); |
| 3 | useWidgetInit(); |
| 4 | }; |
| 5 | // only caller: |
| 6 | const state = useBootstrapState(); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codets
| 1 | // in the provider, call them directly |
| 2 | useSession(); |
| 3 | useWidgetInit(); |
Explanation (EN)
Objašnjenje (HR)