File size: 574 Bytes
f5071ca |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import { connect } from 'react-redux';
import CommentForm from './comment_form';
import { createComment } from '../../actions/comment_actions';
const mapStateToProps = (state, ownProps) => {
const comment = {
authorId: state.session.currentUserId,
postId: ownProps.postId,
body: ''
};
return ({
author: state.entities.users[state.session.currentUserId],
comment
});
};
const mapDispatchToProps = dispatch => ({
action: comment => dispatch(createComment(comment))
});
export default connect(mapStateToProps, mapDispatchToProps)(CommentForm); |