-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
react/prop-types false positive when using props to access array element #1259
Comments
I don't see the propTypes for also, please provide code in text form, instead of screenshots :-) |
Hi,
Code: const steps = [
{
Left: Component1,
Right: Component2,
},
];
const Setup = props => {
const { Left, Right } = steps[props.current];
return (
<div className={style.container}>
<Left {...props} />
<Right {...props} />
</div>
);
};
Setup.propTypes = {
current: PropTypes.number.isRequired,
}; |
Tomorrow, I'll try this: const Setup = props => {
const current = props.current;
const { Left, Right } = steps[current];
return (
<div className={style.container}>
<Left {...props} />
<Right {...props} />
</div>
);
}; To confirm that the problem occurs when using some props as an index key and destructuring. |
I definitely think that |
Hi everything is here:
The text was updated successfully, but these errors were encountered: