Skip to content

Instantly share code, notes, and snippets.

@gCardinal
Last active June 12, 2016 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gCardinal/58dc23d3702d9bf8a4847599674c88bf to your computer and use it in GitHub Desktop.
Save gCardinal/58dc23d3702d9bf8a4847599674c88bf to your computer and use it in GitHub Desktop.
import { connect } from 'react-redux'
import ProfilePicture from 'components/ProfilePicture'
import { changeProfilePicture } from '../actions'
export function mapStateToProps(state:any, ownProps:any):any
{
return {
profilePictureUrl: state.user.profilePictureUrl,
}
}
export function mapDispatchToProps(dispatch:Function):any
{
return {
onClick: () => dispatch(changeProfilePicture),
}
}
export default connect(mapStateToProps, mapDispatchToProps)(ConversationsList);
import * as React from 'react'
export default class ConversationsList extends React.Component
{
propTypes: {
profilePictureUrl: React.PropTypes.string.isRequired,
onClick: React.PropTypes.function.isRequired
}
render() {
let { profilePictureUrl, onClick } = this.props;
return (
<div class="profile-picture" onClick={() => onClick()}>
<img src={profilePictureUrl} />
</div>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment