Using a prop as an object key to call a function, incorrectly reports missing in props validation #132
Closed
Description
Testcase:
var TestComp1 = React.createClass({
propTypes: {
size: React.PropTypes.string.isRequired
},
render: function() {
var foo = {
"abc": ["1", "2", "3"]
};
var icons = foo[this.props.size].map(function() {
return null;
});
return (<div>{icons}</div>);
}
});
Output:
11:37 error 'size[].map' is missing in props validation react/prop-types
✖ 1 problem (1 error, 0 warnings)
this.props.size is being used as the key for the object, not as an object itself.