Skip to content

Commit 781dff7

Browse files
committed
refactor: useMemo 훅을 사용하여 interviewRequired 값이 변경될 때만 categories 배열이 재생성되도록 메모이제이션
1 parent ceb3763 commit 781dff7

File tree

1 file changed

+4
-4
lines changed
  • src/pages/admin/Dashboard/components/ApplicantListSection/List/ApplicantList

1 file changed

+4
-4
lines changed

src/pages/admin/Dashboard/components/ApplicantListSection/List/ApplicantList/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useCallback } from 'react';
1+
import { useCallback, useMemo } from 'react';
22
import { useNavigate, useParams } from 'react-router-dom';
33
import { useApplicants } from '@/pages/admin/Dashboard/hooks/useApplicants';
44
import { STAGE_LABEL } from '@/pages/admin/Dashboard/utils/labelMap';
@@ -30,10 +30,10 @@ export const ApplicantList = ({ filterOption, stage }: Props) => {
3030
interviewRequired,
3131
} = useApplicants(Number(clubId), apiStage, filterOption);
3232

33-
const categories = () => {
33+
const categories = useMemo(() => {
3434
const base: ApplicateInfoCategory[] = ['이름', '학번', '학과', '전화번호', '이메일', '결과'];
3535
return interviewRequired ? [...base, '면접 시간'] : base;
36-
};
36+
}, [interviewRequired]);
3737

3838
const handleItemClick = useCallback(
3939
(applicantId: number) => {
@@ -48,7 +48,7 @@ export const ApplicantList = ({ filterOption, stage }: Props) => {
4848
return (
4949
<S.Container>
5050
<S.ApplicantInfoCategoryList hasInterview={interviewRequired}>
51-
{categories().map((category) => (
51+
{categories.map((category) => (
5252
<S.CategoryText key={category}>{category}</S.CategoryText>
5353
))}
5454
</S.ApplicantInfoCategoryList>

0 commit comments

Comments
 (0)