View the status of a comment edit
View the status of a comment edit in Bitsocial React Hooks. Usage, options, and examples.
let comment = useComment({ commentCid });
const { state: editedCommentState, editedComment } = useEditedComment({ comment });
// if the comment has a succeeded, failed or pending edit, use the edited comment
if (editedComment) {
comment = editedComment;
}
let editLabel;
if (editedCommentState === "succeeded") {
editLabel = { text: "EDITED", color: "green" };
}
if (editedCommentState === "pending") {
editLabel = { text: "PENDING EDIT", color: "orange" };
}
if (editedCommentState === "failed") {
editLabel = { text: "FAILED EDIT", color: "red" };
}