Skip to content

Ban React Fc

Error
small-rules/ban-react-fc

Ban React.FC and similar component type annotations. Use explicit function declarations instead.

Diagnostic Messages

banReactFC
Avoid React.FC/FunctionComponent/VFC/VoidFunctionComponent types. They break debug information and profiling. Use explicit function declarations instead: `function Component(props: Props) { ... }`

Configuration

This rule does not accept options.

{
"jsPlugins": [
"@pobammer-ts/small-rules"
],
"rules": {
"small-rules/ban-react-fc": "error"
}
}

Examples

React FC component type
const Component: React.FC = () => {};
Function component declaration
function Component() {}