react style ternary operator
<img src={this.state.photo} alt="" style={ isLoggedIn ? { display:'block'} : {display : 'none'} } /> // or <img src={this.state.photo} alt="" style={ { display: isLoggedIn ? 'block' : 'none' } } />
adding a if stement in jsx
render() { return ( <View style={styles.container}> {this.state.value == 'news'? <Text>data</Text>: null } </View> ) }
Source: stackoverflow.com
conditional onclick react
onClick={canClick ? this.handler : undefined }
Source: stackoverflow.com