Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save vasanthk/716090db1e712da1c5d0ddeb95ec01f0 to your computer and use it in GitHub Desktop.
Save vasanthk/716090db1e712da1c5d0ddeb95ec01f0 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