I have
type Action = {actionText: string, onClick: VoidFunction}
and I want to use it, optionally, inside MyComponent
props so MyComponent
can have an action (and then it must get both actionText
and onClick
props) or it may not have an action (and then it doesn't get any of them)
so the result will be something like:
type MyComponentType = {title: string} & [optional]Action
what is the best way to do it?