if in react-native jsx code example
Example 1: ternary react
render() {
const isLoggedIn = this.state.isLoggedIn;
return (
The user is {isLoggedIn ? 'currently' : 'not'} logged in.
);
}
Example 2: adding a if stement in jsx
render() {
return (
{this.state.value == 'news'? data : null }
)
}