diff --git a/src/app/(routes)/user/[userId]/page.tsx b/src/app/(routes)/user/[userId]/page.tsx
index e7c0c9f1..c5416c4e 100644
--- a/src/app/(routes)/user/[userId]/page.tsx
+++ b/src/app/(routes)/user/[userId]/page.tsx
@@ -1,20 +1,24 @@
+'use client'
+
import {
Avatar,
CategoryListItem,
FollowListButton,
ProfileEditButton,
+ Spinner,
} from '@/components'
import { CATEGORIES_RENDER, PROFILE_MSG } from '@/constants'
-import { fetchGetUserProfile } from '@/services/users/useUsers'
+import { useGetUserProfile } from '@/services/users/useUsers'
import { UserLayoutProps } from './layout'
-export default async function UserPage({
- params: { userId },
-}: UserLayoutProps) {
- const user = await fetchGetUserProfile({ memberId: userId })
+export default function UserPage({ params: { userId } }: UserLayoutProps) {
+ const { data: user, isFetching: isUserLoading } = useGetUserProfile(
+ Number(userId),
+ )
return (
<>
+ {isUserLoading && }
{user?.profileImagePath && (
diff --git a/src/components/FollowListButton/FollowListButton.tsx b/src/components/FollowListButton/FollowListButton.tsx
index 5bcf48ee..cb67d9da 100644
--- a/src/components/FollowListButton/FollowListButton.tsx
+++ b/src/components/FollowListButton/FollowListButton.tsx
@@ -1,7 +1,7 @@
'use client'
import { PROFILE_MSG } from '@/constants'
-import { useFollowUser, useModal } from '@/hooks'
+import { useModal } from '@/hooks'
import { useCurrentUser } from '@/hooks/useCurrentUser'
import { fetchGetFollowers, fetchGetFollowing } from '@/services/users/useUsers'
import { UserProfileResBody } from '@/types'
@@ -13,13 +13,6 @@ const FollowListButton = ({ user }: { user: UserProfileResBody }) => {
const myId = currentUser?.memberId
const { Modal, isOpen, modalClose, currentModal, handleOpenCurrentModal } =
useModal()
- const { followingCount, setFollowingCount, followerCount } = useFollowUser({
- memberId: user?.memberId || 0,
- isInitFollowing: !!user?.isFollowing,
- followingInitCount: user?.followingCount || 0,
- followerInitCount: user?.followerCount || 0,
- handleOpenCurrentModal,
- })
return (
<>
@@ -28,7 +21,7 @@ const FollowListButton = ({ user }: { user: UserProfileResBody }) => {
onClick={() => {
handleOpenCurrentModal('following')
}}>
- {PROFILE_MSG.FOLLOWING} {followingCount}
+ {PROFILE_MSG.FOLLOWING} {user?.followingCount}
{PROFILE_MSG.LIST_DIVIDER}
{
onClick={() => {
handleOpenCurrentModal('follower')
}}>
- {PROFILE_MSG.FOLLOWER} {followerCount}
+ {PROFILE_MSG.FOLLOWER} {user?.followerCount}
{currentModal !== 'login' && isOpen && (
{
fetchFn={fetchGetFollowing}
myId={myId}
type="following"
- followingCount={followingCount}
- setFollowingCount={setFollowingCount}
+ followingCount={user?.followingCount}
/>
)}
{currentModal === 'follower' && (
@@ -64,8 +56,7 @@ const FollowListButton = ({ user }: { user: UserProfileResBody }) => {
fetchFn={fetchGetFollowers}
myId={myId}
type="follower"
- followingCount={followingCount}
- setFollowingCount={setFollowingCount}
+ followingCount={user?.followingCount}
/>
)}
diff --git a/src/components/PopularLink/PopularLinkList/PopularLinkList.tsx b/src/components/PopularLink/PopularLinkList/PopularLinkList.tsx
index 6a15ec64..a22a701e 100644
--- a/src/components/PopularLink/PopularLinkList/PopularLinkList.tsx
+++ b/src/components/PopularLink/PopularLinkList/PopularLinkList.tsx
@@ -54,8 +54,8 @@ const PopularLinkList = () => {
url={link.url}
tagName={link.tagName}
tagColor={link.tagColor as ChipColors}
- isInitLiked={link.isLiked}
- likeInitCount={link.likeCount}
+ isLiked={link.isLiked}
+ likeCount={link.likeCount}
type="card"
/>
diff --git a/src/components/ProfileEditButton/ProfileEditButton.tsx b/src/components/ProfileEditButton/ProfileEditButton.tsx
index e2ff536d..9f54dd5a 100644
--- a/src/components/ProfileEditButton/ProfileEditButton.tsx
+++ b/src/components/ProfileEditButton/ProfileEditButton.tsx
@@ -6,52 +6,50 @@ import { UserProfileResBody } from '@/types'
import { cls, getProfileButtonColor, getProfileButtonText } from '@/utils'
import { useRouter } from 'next/navigation'
import Button from '../common/Button/Button'
-import DeferredComponent from '../common/DeferedComponent/DeferedComponent'
-import Spinner from '../common/Spinner/Spinner'
const ProfileEditButton = ({ user }: { user: UserProfileResBody }) => {
const router = useRouter()
const { currentUser } = useCurrentUser()
const myId = currentUser?.memberId
const { handleOpenCurrentModal } = useModal()
- const { isFollowing, handleClickFollow } = useFollowUser({
- memberId: user?.memberId || 0,
- isInitFollowing: !!user?.isFollowing,
- followingInitCount: user?.followingCount || 0,
- followerInitCount: user?.followerCount || 0,
+ const { handleClickFollow } = useFollowUser({
+ profileId: user?.memberId || 0,
+ memberId: currentUser?.memberId || 0,
+ myId: myId || 0,
handleOpenCurrentModal,
})
- return myId ? (
-