I want to create a button for ui ki, but I have a problem with FC
error: The "children" property does not exist in the "MyButtonProps" type.
Maybe I need to define a type for my functional component? If so, how do I do it?
It was expected to get this
2
Answers
you need to define type for your functional component props (‘MyButtonProps’) and make sure it includes children property
Since you are using typescript we need to explicitly define the props type, since you might have missed what has caused the problem. Two ways you can have this resolved is either to have type defined as below:
OR
In the second method, object destructuring defines the props type directly within the function parameters.