Skip to content

childrenProps

Reports usage of the children prop.

✅ This rule is included in the jsx stylistic presets.

In JSX, children are generally intended to be passed as content between opening and closing tags rather than as a children prop. This makes the JSX more readable and maintainable by following the standard JSX pattern.

<
JSX.IntrinsicElements.div: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>
div
DOMAttributes<HTMLDivElement>.children?: ReactNode
children
="Hello" />
<
const Component: any
Component
children: JSX.Element
children
={<
JSX.IntrinsicElements.span: DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>
span
>Test</
JSX.IntrinsicElements.span: DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>
span
>} />;
<
JSX.IntrinsicElements.button: DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>
button
DOMAttributes<HTMLButtonElement>.children?: ReactNode
children
={["Click me"]} />

If you prefer the consistency of always using named props including children over aligning with common JSX conventions, you might prefer to disable this rule.

Made with ❤️‍🔥 around the world by the Flint team and contributors.