From ac55be620683a1861c09ded8e9c4215dfb9e500d Mon Sep 17 00:00:00 2001 From: Steven Zhou Date: Sun, 3 Sep 2023 22:43:09 -0700 Subject: [PATCH] fixed map marker locations --- src/components/Map/Map.jsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/components/Map/Map.jsx b/src/components/Map/Map.jsx index 5f8b61f..71e1e34 100644 --- a/src/components/Map/Map.jsx +++ b/src/components/Map/Map.jsx @@ -215,15 +215,14 @@ export default function Map({ } const NewItemMarker = () => { - useMapEvents({ + const map = useMapEvents({ click(event) { - const { lat, lng } = event.latlng; - setPosition([lat, lng]); + setPosition(event.latlng); }, }); - return position[0] !== centerPosition[0] && - position[1] !== centerPosition[1] ? ( + return (position.lat !== centerPosition[0] && + position.lng !== centerPosition[1]) ? (