react/prop-types
false positive with local variable props
#1288
Closed
Description
opened on Jul 6, 2017
Apparently a local variable called props
will be incorrectly considered to be passed props in a functional component.
function Foo() {
const props = {}
props.bar = 'bar'
return <div {...props} />
}
warning 'bar' is missing in props validation react/prop-types
Following is fine:
class Foo extends Component {
render() {
const props = {}
props.bar = 'bar'
return <div {...props} />
}
}
Activity