Answers for "how to render different component in react"

5

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' } }  
/>
Posted by: Guest on July-11-2020
0

how to change grid size with conditional expression in react

<Grid.Column width={ condition ? <column number if true> : <column number if false> } />
<Grid item xs={12} sm={isLogic ? 8 : 12}></Grid>
Posted by: Guest on September-28-2020

Code answers related to "how to render different component in react"

Code answers related to "Javascript"

Browse Popular Code Answers by Language