Proxy components (proxy between React and Mapbox API)
- Layer & Feature
symboldisplays a mapbox symbol.
linedisplays a lineString.
filldisplays a polygon.
circledisplays a mapbox circle.
rasterdisplays a mapbox raster tiles.
fill-extrusiondisplays a layer with extruded buildings.
backgrounddisplays a mapbox background layer.
heatmapdisplays a mapbox heatmap layer.
DOM components (normal React components)
- Marker (Projected component)
- Popup (Projected component)
npm install react-mapbox-gl mapbox-gl --save
// ES6import ReactMapboxGl Layer Feature from "react-mapbox-gl";// ES5var ReactMapboxGl = ;var Layer = ReactMapboxGlLayer;var Feature = ReactMapboxGlFeature;const Map =;// in render()<Map="mapbox://styles/mapbox/streets-v9"=><Layer="symbol"="marker"=><Feature =/></Layer></Map>
pitch Arrays ?
If those properties changed at the mapbox-gl-js level and you don't update the value kept in your state, it will be unsynced with the current viewport. At some point you might want to update the viewport value (zoom, pitch or bearing) with the ones in your state but using value equality is not enough. Taking zoom as example, you will still have the unsynced zoom value therefore we can't tell if you want to update the prop or not. In order to explicitly update the current viewport values you can instead break the references of those props and reliably update the current viewport with the one you have in your state to be synced again.
Please try to reproduce your problem with the boilerplate before posting an issue.
Looking for an Angular alternative?