Closed
Description
When referencing shaped PropTypes, it is producing react/no-unused-prop-types
.
See below:
const myComponent = ({ bar }) => (
<div>
{bar.a}
{bar.n}
{bar.c}
</div>
);
myComponent.propTypes = {
bar: PropTypes.shape({
a: PropTypes.string, // react-no-unused-prop-types
b: PropTypes.string, // react-no-unused-prop-types
c: PropTypes.string, // react-no-unused-prop-types
}),
};
Also errors for:
const myComponent = (props) => {
const bar = props.bar; // produces errors
// const { bar } = props; // produce errors
return (
<div>
{bar.a}
{bar.n}
{bar.c}
</div>
);
}
We would have to use it directly to avoid errors:
const myComponent = (props) => {
return (
<div>
{props.bar.a}
{props.bar.n}
{props.bar.c}
</div>
);
}