0

I want it to be displayed next to the components that the parent calls through to be

<Custom title="1111" checkItem={1} /> will display the text as 1111
<Custom title="2222" checkItem={2} /> will display the text as 2222
<Custom title="3333" checkItem={3} /> will display the text as 3333

but I can only write checkItem={1} and vice versa now I want to display more conditional statements checkItem={2} and checkItem={3} in the code

Here is the code I wrote

interface type {
  title: string;
  checkItem: number;
}
export default function Custom ({title, checkItem}: type) {
  return (  
<View>
      {checkItem == 1 ? (
        <View>
          <Text>{title}</Text>
        </View>
      ) : (
        <View>
          <Text>{title}</Text>
        </View>
      )}
    </View>
  );
}

0 Answers0