-
Hello I've been trying to add markers dynamically by function App() {
return (
<Map
initialViewState={{
longitude: -122.4,
latitude: 37.8,
zoom: 14,
}}
mapStyle="mapbox://styles/mapbox/streets-v9"
style={{ width: "100vw", height: "100vh" }}
>
{data.forEach((data) => (
<Marker longitude={data.long} latitude={data.lat}>
<div>Some info here</div>
</Marker>
))}
</Map>
);
} data is loaded from a server and can change. Thank you! |
Beta Was this translation helpful? Give feedback.
Answered by
tmtygnz
Feb 10, 2023
Replies: 1 comment 1 reply
-
OMG, I'm so dumb i should've used |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
tmtygnz
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
OMG, I'm so dumb i should've used
.map
instead of.forEach
. I am so sorry