Skip to content

Commit

Permalink
feat: #305 불필요하게 리렌더링되는 컴포넌트 메모이제이션
Browse files Browse the repository at this point in the history
불필요하게 리렌더링되는 컴포넌트 메모이제이션
  • Loading branch information
bomi8489 authored Jun 28, 2024
2 parents aa4fe7c + 64a5089 commit 8d2b599
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
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)

0 comments on commit 8d2b599

Please sign in to comment.