Im trying to make it so that if on prop is true, all others will be ignored. My current react code looks like this:
<Component isTrue={true}/>
<Component foo='bar' someProp={true}/>;
But this causes problems because in my Component.tsx
file because the Props
interface
interface Props {
isTrue?: boolean;
foo?: string;
someProp?: boolean;
}
Typescript warns me about the props maybe being undefined which i can fix by adding more lines of code but its pretty troublesome to do everytime i make a new prop.
So i want to know if its possible to have separate props or something to fix this problem, thanks in advance :)