react-map-gl Marker is moving when zooming the map
文章推薦指數: 80 %
I tried to add a marker, but the marker keeps moving when I zoom. What is causing this to happen? import MapGL, { Marker } from "react-map- ...
Resultsfromthe2022DeveloperSurveyarehere.
Home
Public
Questions
Tags
Users
Companies
Collectives
ExploreCollectives
Teams
StackOverflowforTeams
–Startcollaboratingandsharingorganizationalknowledge.
CreateafreeTeam
WhyTeams?
Teams
CreatefreeTeam
Collectives™onStackOverflow
Findcentralized,trustedcontentandcollaboratearoundthetechnologiesyouusemost.
Learnmore
Teams
Q&Aforwork
Connectandshareknowledgewithinasinglelocationthatisstructuredandeasytosearch.
Learnmore
react-map-glMarkerismovingwhenzoomingthemap
AskQuestion
Asked
4monthsago
Modified
4monthsago
Viewed
664times
1
I'vebuiltaReactappwithamapcomponentwhichrendersamap.Itriedtoaddamarker,butthemarkerkeepsmovingwhenIzoom.Whatiscausingthistohappen?
importMapGL,{Marker}from"react-map-gl"
import{useState}from"react";
constMap=()=>{
const[viewState,setViewState]=useState({
longitude:4.895168,
latitude:52.370216,
zoom:10,
})
const[marker]=useState({
longitude:4.895168,
latitude:52.370216,
})
return(
延伸文章資訊
- 1How to display Markers on a Mapbox Map in React
We have our map and our geocoder. We can look up addresses and select one. Let's now display a ma...
- 2@urbica/react-map-gl - npm
Start using @urbica/react-map-gl in your project by running `npm i @urbica/react-map-gl` ... Mark...
- 3Mapbox Marker Clustering in React - Morioh
Even at hundreds of markers using Mapbox via react-map-gl, you may feel it start to lag. By clust...
- 4react-map-gl.Marker JavaScript and Node.js code examples
Best JavaScript code snippets using react-map-gl.Marker(Showing top 7 results out of 315) ; Custo...
- 5Search Code Snippets | react map gl marker - Code Grepper
react map gl markerreact-mapbox-gl custom markeradd custom marker in react-mapbox-glreact map gl ...