Skip to content

Commit

Permalink
fix: 맵 함수를 사용할 때 레스토랑 데이터 존재여부 확인
Browse files Browse the repository at this point in the history
  • Loading branch information
soulchicken committed Aug 7, 2024
1 parent 5db0f0a commit b9fb1a4
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/components/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const Map: React.FC<MapProps> = ({ onClick }) => {
if (!isMapLoaded) {
return <Loading />;
}

return (
<MapDiv
style={{
Expand All @@ -38,14 +37,15 @@ const Map: React.FC<MapProps> = ({ onClick }) => {
defaultCenter={new navermaps.LatLng(37.3595704, 127.105399)}
defaultZoom={15}
>
{restaurants.map((restaurant, index) => (
<CustomMarker
key={index}
navermaps={navermaps}
lat={restaurant.latitude}
lng={restaurant.longitude}
/>
))}
{restaurants &&
restaurants.map((restaurant, index) => (
<CustomMarker
key={index}
navermaps={navermaps}
lat={restaurant.latitude}
lng={restaurant.longitude}
/>
))}
</NaverMap>
</MapDiv>
);
Expand Down

0 comments on commit b9fb1a4

Please sign in to comment.