can i have if else in 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.
);
}