OneBite.Dev - Coding blog in a bite size

Nested multiple condition on ReactJS

How to have a multiple if else condition in ReactJS template that depends on multiple set state variable or just in general

How to have a multiple if else condition in ReactJS template? It can depend on multiple state variable or any value in general.

{
    isLoading 
    ? 'Please wait...' 
    : <>
        { registerMode ? 'Join for free' : 'Login' }     
        </>
}

In above example I have two variables: isLoading and registerMode . Both have boolean values.

If isLoading value is true, then only show please wait.. while if it’s not on loading, it will depend on the value of regsterMode itself.

react