Closed
Description
opened on May 9, 2017
The following is considered an error for the props a
and b
:
import React from 'react';
export default function SomeComponent(props) {
const callback = () => {
props.a(props.b);
};
const anotherCallback = () => {};
return (
<SomeOtherComponent
name={props.c}
callback={callback}
/>
);
}
SomeComponent.propTypes = {
a: React.PropTypes.func.isRequired,
b: React.PropTypes.string.isRequired,
c: React.PropTypes.string.isRequired,
};
Removing the line const anotherCallback = () => {};
fixes the false positive.
The following does not trigger an error:
import React from 'react';
export default function SomeComponent(props) {
const callback = () => {
props.a(props.b);
};
return (
<SomeOtherComponent
name={props.c}
callback={callback}
/>
);
}
SomeComponent.propTypes = {
a: React.PropTypes.func.isRequired,
b: React.PropTypes.string.isRequired,
c: React.PropTypes.string.isRequired,
};
Activity