if statement on div jsx code example
Example 1: inline if in html component
Condition ? Block_For_True : Block_For_False
Example 2: react if statement
render() {
const isLoggedIn = this.state.isLoggedIn;
return (
<div>
The user is <b>{isLoggedIn ? 'currently' : 'not'}</b> logged in. </div>
);
}