I want to show the "a" component when updateFlage is true. Also, when I change feedboolean to true in component "a", I want to show component "b" when updateFlag is true and feedboolean is true. I used the ternary operator, but it doesn't work.
this is my code
<View >
<CusText/>
{updateFlag ?
// "a"
<View >
<ArrowIconPickersecond
/>
</View>
// "b"
{feedboolean ?
(<View >
<TextInput
/>
</View>) : (null) }
:
<CusText />
}
</View>
CodePudding user response:
you are trying to append 2 child's to ternary operator where it support single child
<View>
<CusText />
{updateFlag ? (
// "a"
<view>
<View>
<ArrowIconPickersecond />
</View>
// "b"
{feedboolean ? (
<View>
<TextInput />
</View>
) : null}{" "}
</view>
) : (
<CusText />
)}
</View>;
CodePudding user response:
You can actually do something like this(replace nulls and pseudo functions with your code):
updateFlag ?
(
show(a),
feedboolean ? show(b) : null
)
:
null