Skip to content

Commit

Permalink
hotfix-064: 카드 컴포넌트 key 값 부재로 오류 나는 현상 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
gs0428 committed Feb 13, 2024
1 parent e031173 commit eb71120
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/components/Home/InsightVideos.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const InsightVideos: React.FC<InsightVideosProps> = ({
checkedVideos={checkedItems}
setCheckedVideos={setCheckedItems}
onFileClick={onFileClick}
key={video.category_id}
/>
))}
</CardContainer>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Home/RecentVideos.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const RecentVideos = ({ videos }: IRecentVideosProp) => {
{videos.length > 0 && (
<CardContainer>
{videos.map((video) => (
<Card mode="default" video={video} />
<Card key={video.category_id} mode="default" video={video} />
))}
</CardContainer>
)}
Expand Down
3 changes: 2 additions & 1 deletion src/components/category/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ const Card: React.FC<ICardProps> = ({
}) => {
const [isOpen, setIsOpen] = useState(false);
const category = useRecoilValue(categoryState);

const [selectedCategoryId, setSelectedCategoryId] = useState(
category[0].categoryId,
category.length ? category[0].categoryId : -1,
);

const handleSelectCategory = (categoryId: number) => {
Expand Down

0 comments on commit eb71120

Please sign in to comment.