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
reacthocdevtools
Set displayName on HOC-wrapped components for DevTools
Give a higher-order-component wrapper a displayName reflecting the wrapped component so DevTools shows a useful name.
PR: hegnar-forum-web · org-mining-deep-2026-06Created: Jun 17, 2026
Bad example
Old codetsx
| 1 | return function Wrapped(props) { ... }; // shows as 'WrappedComponent' in DevTools |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | Wrapped.displayName = `withSorting(${getDisplayName(Component)})`; |
Explanation (EN)
Objašnjenje (HR)