Skip to content

Instantly share code, notes, and snippets.

@ralphholzmann
Created August 25, 2016 16:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ralphholzmann/7f6e3f8565a9345e12f4760fdf258d83 to your computer and use it in GitHub Desktop.
Save ralphholzmann/7f6e3f8565a9345e12f4760fdf258d83 to your computer and use it in GitHub Desktop.
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;
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