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
reactnamingreadabilityjsx
Inline single-use JSX and only PascalCase real components
Don't hoist a chunk of JSX into a variable that's used once; inline it. And a value that is not a React component should be camelCase, since PascalCase implies a component.
PR: hegnar-components · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetsx
| 1 | const ButtonContent = (<span>{label}</span>); // not a component, used once |
| 2 | return <button>{ButtonContent}</button>; |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | return <button><span>{label}</span></button>; // inline it |
Explanation (EN)
Objašnjenje (HR)