Skip to content

Commit 53e1ae6

Browse files
committed
Refactor: 바텀시트 내부 핸들러 & BottomSheetMenu 불필요한 리렌더링 방지
1 parent b8530aa commit 53e1ae6

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/components/BottomSheet/styles.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import React from 'react';
12
import styled from 'styled-components';
23

34
export const BottomSheetWrapper = styled.div<{ $isOpenBottomSheet: boolean }>`
@@ -39,7 +40,7 @@ export const BottomSheetLayout = styled.div<{
3940
transition: transform 0.3s;
4041
`;
4142

42-
export const Handler = styled.hr`
43+
export const Handler = React.memo(styled.hr`
4344
width: 3rem;
4445
margin: 0 auto;
4546
height: 0.25rem;
@@ -48,4 +49,4 @@ export const Handler = styled.hr`
4849
border-radius: 0.125rem;
4950
z-index: 300;
5051
cursor: pointer;
51-
`;
52+
`);

src/components/BottomSheetMenu/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ import { StyledText } from '../Text/StyledText';
22
import theme from '../../styles/theme';
33
import { BottomSheetMenuLayout, SheetItem, Icon } from './styles';
44
import { BottomSheetMenuProps, SheetItemDto } from './dto';
5+
import React from 'react';
56

6-
const BottomSheetMenu: React.FC<BottomSheetMenuProps> = ({ items, marginBottom }) => {
7+
const BottomSheetMenu: React.FC<BottomSheetMenuProps> = React.memo(({ items, marginBottom }) => {
78
return (
89
<BottomSheetMenuLayout $marginBottom={marginBottom}>
910
{items.map((item: SheetItemDto, index) => (
@@ -19,6 +20,6 @@ const BottomSheetMenu: React.FC<BottomSheetMenuProps> = ({ items, marginBottom }
1920
))}
2021
</BottomSheetMenuLayout>
2122
);
22-
};
23+
});
2324

2425
export default BottomSheetMenu;

0 commit comments

Comments
 (0)