childrenProps
Reports usage of the children prop.
✅ This rule is included in the jsx stylistic preset.
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.
Examples
Section titled “Examples”<div children="Hello" /><Component children={<span>Test</span>} /><button children={["Click me"]} /><div>Hello</div><Component> <span>Test</span></Component><button>Click me</button>When Not To Use It
Section titled “When Not To Use It”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.
Further Reading
Section titled “Further Reading”Equivalents in Other Linters
Section titled “Equivalents in Other Linters”- Deno:
jsx-no-children-prop - ESLint:
react/no-children-prop
Made with ❤️🔥 in Boston by
Josh Goldberg and contributors.