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
reacthooksapi-designreadability
Group a hook's return value into data and actions
For hooks returning many values, group them under data and actions keys for readability, and drop redundant suffixes like 'data' from individual names.
PR: vinify-frontend · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetypescript
| 1 | return { recordsData, isLoadingData, setFilterData, refetchData }; |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | return { |
| 2 | data: { records, isLoading }, |
| 3 | actions: { setFilter, refetch }, |
| 4 | }; |
Explanation (EN)
Objašnjenje (HR)