Is there an existing issue for this?
Description Overview
When allowFunctions is set to true, the react/no-children-prop rule does not report function as children in the child position, which contradicts the documented behaviour for this option.
According to the rule docs under 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:
<MyComponent>{data => data.value}</MyComponent>
React.createElement(MyComponent, {}, data => data.value)
ES Lint config:
"react/no-children-prop": ["error", {
"allowFunctions": true
}]
Example:
<MyComponent>{data => data.value}</MyComponent>
No error is reported for the above code.
This contradicts the documentation, which states that when allowFunctions is true, functions should not be passed as children in the child position.
Expected Behavior
When allowFunctions is true, functions as children in the child position should be reported as incorrect code.
eslint-plugin-react version
v7.37.5
eslint version
v9.39.1
node version
v24.12.0
Is there an existing issue for this?
Description Overview
When
allowFunctionsis set totrue, thereact/no-children-proprule does not report function aschildrenin the child position, which contradicts the documented behaviour for this option.According to the rule docs under
allowFunctions:ES Lint config:
Example:
No error is reported for the above code.
This contradicts the documentation, which states that when
allowFunctionsistrue, functions should not be passed aschildrenin the child position.Expected Behavior
When
allowFunctionsistrue, functions aschildrenin the child position should be reported as incorrect code.eslint-plugin-react version
v7.37.5
eslint version
v9.39.1
node version
v24.12.0