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}
1render() {
2 return (
3 <View style={styles.container}>
4 {this.state.value == 'news'? <Text>data</Text>: null }
5 </View>
6 )
7}
1render() {
2 const isLoggedIn = this.state.isLoggedIn;
3 return (
4 <div>
5 The user is <b>{isLoggedIn ? 'currently' : 'not'}</b> logged in. </div>
6 );
7}