Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Multiple Conditions in RectNative shows two conditions in the same time

component1 should show up if options is less than 4.
component2 should show up if options is more than 4.
component3 should show up if options is more than 7.
Right now if my options array has less than 4 values it displays together component1 with component3. Why is that so?

<View>
{options.length < 4 && (
<Component1
 options={options}
/>
)}
{options.length > 4 && (
<Component2 options={options}/>
)}
{options.length < 7 && (
<Component3 options={options}/>
)}
</View>

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Try this code you need to check for multiple conditions if there is ant

      <View>
        {options.length < 4 && 
          <Component1 options={options} />
        }
        {options.length > 4 && options.length < 7 && (
          <Component2 options={options} />
        )}
        {options.length > 7 && 
          <Component3 options={options} />
        }
      </View>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading