Skip to contentSlop Block

prefer-function-components

Warning

Declare React components with function, not as arrow functions assigned to a const.

const Header = () => <header />;Replace the arrow function for $NAME with a function declaration
export const Card = (props: CardProps) => {Replace the arrow function for $NAME with a function declaration	return <div {...props} />;};
// ast-grep-ignore: prefer-function-components-typescript

How to fix

Write function $NAME(props: Props) { ... } or export function $NAME(...).

Wrappers such as memo(function $NAME() { ... }) are allowed.