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
reacttypescriptreact-fctypes
Type function components by usage rather than forcing React.FC
You don't need to annotate a function component with React.FC just to validate its return; TypeScript flags an invalid React node where it's rendered, so add the annotation only when authoring shared/library components.
PR: hegnar-web · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetsx
| 1 | const Card: React.FC<Props> = ({ title }) => <h2>{title}</h2>; |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | function Card({ title }: Props) { |
| 2 | return <h2>{title}</h2>; |
| 3 | } |
Explanation (EN)
Objašnjenje (HR)