mirror of
https://github.com/astuto/astuto.git
synced 2025-12-16 03:37:56 +01:00
Add basic version of Comments component
This commit is contained in:
26
app/javascript/containers/Comments.tsx
Normal file
26
app/javascript/containers/Comments.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import { requestComments } from '../actions/requestComments';
|
||||
|
||||
import { State } from '../reducers/rootReducer';
|
||||
|
||||
import CommentsP from '../components/Comments/CommentsP';
|
||||
|
||||
const mapStateToProps = (state: State) => ({
|
||||
comments: state.currentPost.comments.items,
|
||||
areLoading: state.currentPost.comments.areLoading,
|
||||
error: state.currentPost.comments.error,
|
||||
page: state.currentPost.comments.page,
|
||||
haveMore: state.currentPost.comments.haveMore,
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
requestComments(postId: number, page: number = 1) {
|
||||
dispatch(requestComments(postId, page));
|
||||
},
|
||||
});
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps,
|
||||
)(CommentsP);
|
||||
Reference in New Issue
Block a user