فهرست منبع

Fixing issues in the map component

Kirk Trombley 5 سال پیش
والد
کامیت
1a1b7de69e
1فایلهای تغییر یافته به همراه6 افزوده شده و 17 حذف شده
  1. 6 17
      client/src/components/map-screen.component.jsx

+ 6 - 17
client/src/components/map-screen.component.jsx

@@ -1,23 +1,14 @@
-import React, { useState, useRef, useEffect } from "react";
-import Loading from "./loading.component";
+import React, { useRef, useEffect } from "react";
 /* global google */
 
-
-const MapScreen = ({
-
-}) => {
+const MapComponent = () => {
   const mapDivRef = useRef(null);
-  const [map, setMap] = useState(null);
   useEffect(() => {
-    if (map) {
-      return;
-    }
-    const newMap = new google.maps.Map(mapDivRef.current, {
+    const googleMap = new google.maps.Map(mapDivRef.current, {
       center: { lat: 25, lng: -25 },
       zoom: 0,
     });
     console.log("Created Map");
-    setMap(map);
   });
 
   return (
@@ -28,10 +19,8 @@ const MapScreen = ({
         justifyContent: "center",
       }} 
       ref={mapDivRef}
-    >
-      {map ? null : <Loading/>}
-    </div>
-  )
+    />
+  );
 }
 
-export default MapScreen;
+export default MapComponent;