make a if in jsx
renderElement(){
if(this.state.value == 'news')
return <Text>data</Text>;
return null;
}
render() {
return (
<View style={styles.container}>
{ this.renderElement() }
</View>
)
}var loginButton;
if (loggedIn) {
loginButton = <LogoutButton />;
} else {
loginButton = <LoginButton />;
}
return (
<nav>
<Home />
{loginButton}
</nav>
);
render() {
const isLoggedIn = this.state.isLoggedIn;
return (
<div>
The user is <b>{isLoggedIn ? 'currently' : 'not'}</b> logged in. </div>
);
}
Also in JavaScript:
- bootstrap dropdown not working in angular 8
- express router file
- access to xmlhttprequest at angular 8
- state wheteher true or false The charioteer sprinkled sacred water on the king.
- formato json
- react tooltip on disabled button
- javascript tutorial
- for(let [key,val] in obj){ messageBody = messageBody.replace("{"+ key + "}",val) }
- ClassNotFoundException: com.fasterxml.jackson.core.JsonGenerator
- settimeout jquery
- chart js rotating the x axis labels
- 3 = signs in javasdcript
- como utilizar jquery
- javascript array stackoverflow
- jquery on scroll down
- javascript split by comma
- js if else
- angular navigate using component
- update table remove a key from json object mysql
- Levenshtein Distance algorithm javascript
- javascript add class
- uppercase string in js
- javascript var vs let '
- minecraft