I have a problem deleting a comment on my post. How would you do it? I'm using the Angular NGXS state management. Pls see this link
onDeleteComment(commentId: number){
this.store.dispatch(new DeleteComment(commentId));
}
@Action(DeleteComment)
deleteComment(
ctx: StateContext<PostStateModel>,
{ commentId }: DeleteComment
) {
const state = ctx.getState();
const filteredArray = state.post.comments.find(
item => item.id === commentId
);
console.log(filteredArray);
}