Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

불필요하게 리렌더링되는 컴포넌트 메모이제이션 #306

Merged
merged 2 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/components/common/CategoryList/CategoryList.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use client'

import React from 'react'
import 'swiper/css'
import 'swiper/css/free-mode'
import 'swiper/css/pagination'
Expand Down Expand Up @@ -66,4 +67,4 @@ const CategoryList = ({
)
}

export default CategoryList
export default React.memo(CategoryList)
3 changes: 2 additions & 1 deletion src/components/common/CategoryList/CategoryListItem.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use client'

import React from 'react'
import { cls } from '@/utils'
import Link from 'next/link'
import { usePathname, useSearchParams } from 'next/navigation'
Expand Down Expand Up @@ -63,4 +64,4 @@ const CategoryListItem = ({
)
}

export default CategoryListItem
export default React.memo(CategoryListItem)
3 changes: 2 additions & 1 deletion src/components/common/Comment/Comment.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use client'

import React from 'react'
import { useModal } from '@/hooks'
import { useCurrentUser } from '@/hooks/useCurrentUser'
import { getElapsedTime } from '@/utils'
Expand Down Expand Up @@ -162,4 +163,4 @@ const Comment = ({
)
}

export default Comment
export default React.memo(Comment)
3 changes: 2 additions & 1 deletion src/components/common/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use client'

import React from 'react'
import { useCurrentUser } from '@/hooks/useCurrentUser'
import { cls } from '@/utils'
import { LinkIcon } from '@heroicons/react/20/solid'
Expand Down Expand Up @@ -80,4 +81,4 @@ const Header = () => {
)
}

export default Header
export default React.memo(Header)
3 changes: 2 additions & 1 deletion src/components/common/LinkItem/LinkItem.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use client'

import React from 'react'
import { useForm } from 'react-hook-form'
import TagInput from '@/components/TagInput/TagInput'
import { useModal } from '@/hooks'
Expand Down Expand Up @@ -396,4 +397,4 @@ const LinkItem = ({
)
}

export default LinkItem
export default React.memo(LinkItem)
3 changes: 2 additions & 1 deletion src/components/common/Space/Space.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use client'

import React from 'react'
import { useModal } from '@/hooks'
import { useCurrentUser } from '@/hooks/useCurrentUser'
import {
Expand Down Expand Up @@ -168,4 +169,4 @@ const Space = ({
)
}

export default Space
export default React.memo(Space)
Loading