I have ListItem and I want you make it red in certain cases. I've created styled mui component:
function StyledListItem({ hasErrors, ...props }) {
const classes = listItemStyles();
return (
<ListItem
classes={{
root: clsx({
[classes.root]: hasErrors,
}),
selected: clsx({
[classes.selected]: hasErrors,
}),
}}
{...props}
/>
);
}
In this case I have ESLint error: "'hasErrors' is missing in props validation". If I do this
function StyledListItem(props: any) {
...
}
I've got Warning: React does not recognize the hasErrors prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase haserrors instead. If you accidentally passed it from a parent component, remove it from the DOM element.
How can I get rid of "'hasErrors' is missing in props validation" error?