Skip to content

Instantly share code, notes, and snippets.

@OlivierJM
Created August 22, 2018 11:09
Show Gist options
  • Save OlivierJM/a967453269adec979340f1212f2895ef to your computer and use it in GitHub Desktop.
Save OlivierJM/a967453269adec979340f1212f2895ef to your computer and use it in GitHub Desktop.
// class component with destructuring
class UserSection extends React.Component {
render(){
const { user, isActive } = this.props;
return(
<div>
<p>{user.name}</p> <span>{isActive ? 'active' : 'offline'}</span>
</div>
)
}
}
// class component without destructuring
class UserSection extends React.Component {
render(){
return(
<div>
<p>{this.props.user.name}</p> <span>{this.props.isActive ? 'active' : 'offline'}</span>
</div>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment