1render () {
2 return (
3 <div>
4 {(() => {
5 if (someCase) {
6 return (
7 <div>someCase</div>
8 )
9 } else if (otherCase) {
10 return (
11 <div>otherCase</div>
12 )
13 } else {
14 return (
15 <div>catch all</div>
16 )
17 }
18 })()}
19 </div>
20 )
21}
22
1render () {
2 return (
3 <div className="row">
4 { //Check if message failed
5 (this.state.message === 'failed')
6 ? <div> Something went wrong </div>
7 : <div> Everything in the world is fine </div>
8 }
9 </div>
10 );
11}
1renderElement(){
2 if(this.state.value == 'news')
3 return <Text>data</Text>;
4 return null;
5}
6
7render() {
8 return (
9 <View style={styles.container}>
10 { this.renderElement() }
11 </View>
12 )
13}