Skip to content
Advertisement

Add type for onClick property which is in …props in React TypeScript

I have a button component in which I’m trying to write the prop types using type and I see this error in the console. Could anyone please help?

JavaScript

Excerpt from my code

JavaScript

Advertisement

Answer

You need to add onClick into Props like:

JavaScript
User contributions licensed under: CC BY-SA
11 People found this is helpful
Advertisement