What is the best practice for having 2 optional props in a component required together with react/typescript.
export interface MyComponentProps {
firstName?: string;
lastName?: string;
}
const myComponent: React.FC<MyComponentProps> = (props) => {
return <div ...>
}
my thoughts for requiring both being
export interface Name {
firstName: string;
lastName: string;
}
export interface MyComponentProps {
name?: Name
}
Would this be the best way, or is there another solution out there?