Skip to content

Commit

Permalink
fix: 좋아요 개수가 갱신 안되는 문제를 해결(#160)
Browse files Browse the repository at this point in the history
- Post.tsx에서 useEffect서 setLikesCount(post.likes.length)를 추가해서
  좋아요도 클릭 했을 때 좋아요 개수도 바로 바뀌도록 수정함.
  • Loading branch information
nakyeonko3 committed Sep 12, 2024
1 parent 60561c5 commit a26289b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/components/post/Post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ const Post: React.FC<PostProps> = ({ post, isDetail = false }) => {
useEffect(() => {
if (currentUser) {
setIsLiked(post.likes.includes(currentUser.uid));
setLikesCount(post.likes.length);
}
}, [currentUser, post.likes]);

Expand Down

0 comments on commit a26289b

Please sign in to comment.