Reputation: 123
I want to show components when one of the three product categorys are selected.
Its not working.
{ step === 2 && (product.category.category_name === 'clothing') || (product.category.category_name === 'accessoires') || (product.category.category_name === 'shoes') && return (<View><Text>Hello</Text></View> ) }
If clothing or accessoires or shoes exists then I want to show a component. Its not working why ? If I remove all except clothing then it works.
Upvotes: 0
Views: 121
Reputation: 133
I think you should chain better your conditionals &&
and ||
.
Try this code:
if (step === 2)
{
if (product.category.category_name === 'clothing' ||
product.category.category_name === 'accessoires' ||
product.category.category_name === 'shoes' )
{
return (<View><Text>Hello</Text></View> )
}
}
Upvotes: 1