using if else in react code example
Example 1: if else react render in jsc
const functionalComponent=()=> {
return (
<div>{
props.isFeatured ? (
<div className="featured_ovelay_icon">lol</div>
) : ("")
}
</div>
);
}
Example 2: react if statement
render() {
const isLoggedIn = this.state.isLoggedIn;
return (
<div>
The user is <b>{isLoggedIn ? 'currently' : 'not'}</b> logged in. </div>
);
}