diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Map.tsx | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Map.tsx b/src/Map.tsx index 032b6dd..62bebb2 100644 --- a/src/Map.tsx +++ b/src/Map.tsx @@ -22,6 +22,8 @@ function Map({ slider, images }: MapProps) { const [lat, setLat] = useState(31.9); const [zoom, setZoom] = useState(6.3); + const prevImages = useRef({ images }).current; + useEffect(() => { if (map.current) return; // initialize map only once map.current = new mapboxgl.Map({ @@ -45,6 +47,11 @@ function Map({ slider, images }: MapProps) { }); }); + useEffect(() => { + // handle layer updates + console.log(images) + }, [images]); + return ( <div> <div ref={mapContainer} className="map-container" style={{ |
