how to put if else statement inside of jsx code example
Example 1: adding a if stement in jsx
render() {
return (
{this.state.value == 'news'? data : null }
)
}
Example 2: react if statement
render() {
const isLoggedIn = this.state.isLoggedIn;
return (
The user is {isLoggedIn ? 'currently' : 'not'} logged in.
);
}