Answers for "conditional rendering react typescript"

0

conditional rendering react typescript

type GeneralType = {
  item1?: string;
  item2: number;
 };
 
const GeneralComponent = (props: GeneralType) => {
  if (props.item1) {
    return <ComponentA {...props} />
  } else {
    return <ComponentB {...props} />
  }
}
Posted by: Guest on March-25-2022

Code answers related to "conditional rendering react typescript"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language