Created
February 29, 2016 08:54
-
-
Save mattiamanzati/509617a491ef50b94d5a 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
import {getLoggedUser} from './selectors'; | |
class LoggedUserName extends React.Component{ | |
render(){ | |
return this.props.user ? <p>{this.props.user.username}</p> : <p>Anonymous Cow</p>; | |
} | |
} | |
function mapStateToProps(state){ | |
return { | |
user: getLoggedUser(state) | |
}; | |
} | |
LoggedUserName = connect(mapStateToProps)(LoggedUserName); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment