-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
Description
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,
};nickbouton and huy-nguyen