react/prop-types eslint error in typescript react component
I ended up rewriting the component as:
const Button = ({ children, onClick }: ButtonProps) => {
return <button onClick={onClick} style={styles} type="button">
{children}
</button>;
};
The : React.FC<ButtonProps>
part was ignored by eslint so I decided to provide prop types in a more straightforward way
More info to your answer..
Firstly both ways are correct for declaring types, But React.FC has some added benefits. https://github.com/typescript-cheatsheets/react-typescript-cheatsheet/blob/master/README.md#function-components
And in your scenario you may be using eslint-react-plugin which has recommended rules 'plugin:react/recommended' for eslint ,
Rule to check proptypes is one among them, check typescript example.
https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prop-types.md
So react/prop-types rule will conflict with TS Interfaces, which is why it shows that error, once you add : ButtonProps, we don't have to provide React.FC