Skip to content

Commit

Permalink
fix #35
Browse files Browse the repository at this point in the history
  • Loading branch information
GraemeFulton committed Jun 23, 2024
1 parent 36df237 commit 350db2b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions components/LikeButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,12 @@ const LikeButton = ({ post, user }) => {
newLikeCountObj[reaction] = addLike
? newLikeCountObj[reaction] + 1
: newLikeCountObj[reaction] - 1;
const totalLikes = Object.values(newReactions).reduce(
(total, reaction) => total + (reaction ? 1 : 0),
0
);
newLikeCountObj.total = totalLikes;
// const totalLikes = Object.values(newReactions).reduce(
// (total, reaction) => total + (reaction ? 1 : 0),
// 0
// );
// newLikeCountObj.total = totalLikes;
newLikeCountObj.total = addLike? likeCount.total + 1: likeCount.total - 1;
setLikeCount(newLikeCountObj);

try {
Expand Down

0 comments on commit 350db2b

Please sign in to comment.