Created
August 25, 2016 16:05
-
-
Save ralphholzmann/7f6e3f8565a9345e12f4760fdf258d83 to your computer and use it in GitHub Desktop.
This file contains 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 UserDetail extends Base { | |
render () { | |
let { user } = this.props; | |
return ( | |
<strong>{user.name}</strong> | |
); | |
} | |
} | |
function mapStateToProps (props) { | |
return { user: [['user'], function (userList) { | |
return userList.find((user) => { | |
return user.get('id') === props.routeParams.id; | |
}).toJS(); | |
}] }; | |
} | |
const ConnectedChild = connect(mapStateToProps)(UserDetail); | |
export default ConnectedChild; |
This file contains 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 UserDetail extends Base { | |
render () { | |
let user = this.props.user.toJS(); | |
return ( | |
<strong>{user.name}</strong> | |
); | |
} | |
} | |
function mapStateToProps (props) { | |
return { user: [['user'], function (userList) { | |
return userList.find((user) => { | |
return user.get('id') === props.routeParams.id; | |
}); | |
}] }; | |
} | |
const ConnectedChild = connect(mapStateToProps)(UserDetail); | |
export default ConnectedChild; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment