Skip to content

Commit

Permalink
faet #18 컴포넌트 의존도 절감
Browse files Browse the repository at this point in the history
  • Loading branch information
lee7198 committed Jan 20, 2024
1 parent 1dd4705 commit d2ed17a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
7 changes: 1 addition & 6 deletions src/pages/Register/components/Place/components/Selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ import { NearPlacesType } from '@src/types/register';
export default function Selector({
index,
setIndex,
initAddress,
places,
isLoading,
}: {
index: number;
setIndex: React.Dispatch<React.SetStateAction<number>>;
initAddress: () => void;
places: NearPlacesType[];
isLoading: boolean;
}) {
Expand Down Expand Up @@ -57,10 +55,7 @@ export default function Selector({
) : (
<>
<div
onClick={() => {
handleIdx(-1);
initAddress();
}}
onClick={() => handleIdx(-1)}
className="cursor-pointer px-3 py-1.5 active:bg-slate-200"
>
직접 입력할게요
Expand Down
3 changes: 2 additions & 1 deletion src/pages/Register/components/Place/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ function Place() {
mapY: places[index].y,
},
}));
} else if (index === -1) {
initAddress();
}
}, [index]);

Expand All @@ -100,7 +102,6 @@ function Place() {
<Selector
index={index}
setIndex={setIndex}
initAddress={() => initAddress()}
places={places}
isLoading={position ? isLoading : true}
/>
Expand Down

0 comments on commit d2ed17a

Please sign in to comment.