Created
August 22, 2018 11:09
-
-
Save OlivierJM/a967453269adec979340f1212f2895ef to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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