# react/no-children-prop 📝 Disallow passing of children as props. 💼 This rule is enabled in the ☑️ `recommended` [config](https://github.com/jsx-eslint/eslint-plugin-react/#shareable-configs). Children should always be actual children, not passed in as a prop. When using JSX, the children should be nested between the opening and closing tags. When not using JSX, the children should be passed as additional arguments to `React.createElement`. ## Rule Details Examples of **incorrect** code for this rule: ```jsx
} /> React.createElement("div", { children: 'Children' }) ``` Examples of **correct** code for this rule: ```jsx
Children
Children Child 1 Child 2 React.createElement("div", {}, 'Children') React.createElement("div", 'Child 1', 'Child 2') ``` ## Rule Options ```js "react/no-children-prop": [, { "allowFunctions": || false }] ``` ### `allowFunctions` When `true`, and passing a function as `children`, it must be in prop position and not child position. The following patterns are considered warnings: ```jsx {data => data.value} React.createElement(MyComponent, {}, data => data.value) ``` The following are **not** considered warnings: ```jsx data.value} /> React.createElement(MyComponent, { children: data => data.value }) ```