react/no-children-prop
eslint-plugin-react
No autofixRecommended
eslint.config.js
import react from "eslint-plugin-react";
export default [
{
plugins: { react },
rules: {
"react/no-children-prop": "error",
},
},
];<div children='Children' />
<MyComponent children={<AnotherComponent />} />
<MyComponent children={['Child 1', 'Child 2']} />
React.createElement("div", { children: 'Children' })<div>Children</div>
<MyComponent>Children</MyComponent>
<MyComponent>
<span>Child 1</span>
<span>Child 2</span>
</MyComponent>
React.createElement("div", {}, 'Children')
React.createElement("div", 'Child 1', 'Child 2')Examples from the ESLint documentation.
react/no-children-prop
eslint-plugin-react
import react from "eslint-plugin-react";
export default [
{
plugins: { react },
rules: {
"react/no-children-prop": "error",
},
},
];react/no-children-prop
react plugin · correctness
{
"plugins": [
"react"
],
"rules": {
"react/no-children-prop": "error"
}
}correctness/noChildrenProp
correctness · since 1.0.0
{
"linter": {
"rules": {
"correctness": {
"noChildrenProp": "error"
}
}
}
}Disallow usage of the return value of ReactDOM.render
Disallow missing key props in iterators/collection literals
Enforce ES5 or ES6 class for returning value in render function