🌐
GitHub
github.com › alex3165 › react-mapbox-gl
GitHub - alex3165/react-mapbox-gl: A React binding of mapbox-gl-js · GitHub
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 ...
Starred by 2K users
Forked by 533 users
Languages   TypeScript 93.7% | CSS 3.1% | HTML 2.5%
🌐
GitHub
github.com › urbica › react-map-gl
GitHub - urbica/react-map-gl: React Component Library for Mapbox GL JS · GitHub
import React, { useState } from 'react'; import MapGL from '@urbica/react-map-gl'; import 'mapbox-gl/dist/mapbox-gl.css'; const [viewport, setViewport] = useState({ latitude: 37.78, longitude: -122.41, zoom: 11 }); <MapGL style={{ width: '100%', ...
Starred by 424 users
Forked by 49 users
Languages   JavaScript
🌐
npm
npmjs.com › package › react-mapbox-gl
react-mapbox-gl - npm
November 26, 2020 - 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 ...
      » npm install react-mapbox-gl
    
Published   Nov 26, 2020
Version   5.1.1
🌐
GitHub
github.com › preecedavid › React-Mapbox-gl
GitHub - preecedavid/React-Mapbox-gl
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 ...
Author   preecedavid
🌐
React Map GL
visgl.github.io › what's new
What's new | react-map-gl
This is the React wrapper around Mapbox GL JS and takes in viewport properties such as width, height, latitude, longitude. Style diffing and updating logic also live here.
🌐
npm
npmjs.com › package › @mapbox › react-map-gl
mapbox/react-map-gl
Using react-map-gl requires react >= 16.3. ... import {Component} from 'react'; import ReactMapGL from 'react-map-gl'; class Map extends Component { state = { viewport: { width: 400, height: 400, latitude: 37.7577, longitude: -122.4376, zoom: 8 } }; ...
      » npm install @mapbox/react-map-gl
    
Published   Apr 29, 2019
Version   4.2.0-dev
🌐
DEV Community
dev.to › joowoonk › how-did-i-play-with-mapbox-gl-on-react-hooks-part-1-4pkl
How to use Mapbox GL on React (hooks), displaying map on your component - Part 1 - DEV Community
September 25, 2020 - After successfully installing the library to your app, go ahead and make a component file that's to display the Mapbox. Then you will need to import the ReactMapGL component from the library. On the top of your editor before you define your component import this as follows: ... Then you will need to create useState to set your map for where and how close your map want to be zoomed in as a default. I named it viewport and coded it as follows:
🌐
DEV Community
dev.to › ivanbtrujillo › fit-viewport-to-markers-using-react-map-gl-3ig1
Fit viewport to markers using react-map-gl - DEV Community
December 20, 2020 - Use your mapbox token. For security reasons, it should go in your environment variables. We will use two refs here. mapContainerRef: a reference to the container. This is needed to get the viewport width and height as a numeric value (mercator viewport doesn't support string values like "100%"). ... import React from "react"; import ReactMapGL, { Marker, NavigationControl } from "react-map-gl"; import "mapbox-gl/dist/mapbox-gl.css"; import "./map.css"; const MAP_STYLE = { width: "100%", height: "100%" }; const MAP_CONFIG = { maxZoom: 20, mapStyle: "mapbox://styles/mapbox/dark-v10", mapboxApiAc
🌐
Mapbox
docs.mapbox.com › all docs
Mapbox GL JS | Mapbox
You can use Mapbox GL JS to display Mapbox maps in a web browser or client, add user interactivity, and customize the map experience in your application. JavaScript · <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Guides</title> ...
Find elsewhere
🌐
LogRocket
blog.logrocket.com › home › using mapbox gl js with react
Using Mapbox GL JS with React - LogRocket Blog
June 4, 2024 - If you wish to use the defaults, you can use the same viewport change handler as Mapbox. The geocoder also requires the Mapbox token to access the Mapbox API and fetch locations. When searching, our geocoder will suggest some locations as shown below. You will also notice that we created and used a ref that integrates the two components, and is passed to both as a mapRef prop. The last piece in our searchable map is the deck.gl ...
🌐
Medium
medium.com › @layne_celeste › react-mapbox-a-map-made-in-heaven-part-2-9f26f8cad12f
React & Mapbox | A Map Made in Heaven, Part 2 | by Celeste Layne | Medium
February 11, 2020 - It is the default exported component ... · viewport: you can specify latitude and longitude of the object that you want to define the center of your map, as well as how zoomed in on that object you want to be....
🌐
React Map GL
visgl.github.io › tips and tricks
Tips and Tricks | react-map-gl
<TabPanel value="map"> <Map reuseMaps mapStyle="mapbox://styles/mapbox/streets-v9" > {items.map(renderMarker)} </Map> </TabPanel> This bypasses the initialization when a map is removed then added back. If your application uses externally managed camera state, like with Redux, the number of React rerenders may be very high when the user is interacting with the map. Consider the following setup: import {useSelector, useDispatch} from 'react-redux'; import Map, {Marker} from 'react-map-gl/maplibre'; function MapView() { const viewState = useSelector((s: RootState) => s.viewState); const vehicles
🌐
React Map GL
visgl.github.io › react-map-gl
Home | react-map-gl
Comes with additional React interfaces such as context and hooks to support custom components. Use together with e.g. deck.gl to render performant and compelling 2D and 3D WebGL visualizations on top of your MapLibre GL JS and Mapbox GL JS based maps.
🌐
GitHub
github.com › alex3165 › react-mapbox-gl › issues › 572
How about react-map-gl's 'controlled viewport state' strategy? · Issue #572 · alex3165/react-mapbox-gl
April 12, 2018 - I've used react-mapbox-gl profitably for a while, and it's great. However there are often issues with updating the viewport. React-map-gl (Uber) has a really robust strategy of being viewport-stateless. The viewport state is hosted by a ...
🌐
Ojlamb
ojlamb.com › React-Map-GL
Working with react-map-gl - Owen Lamb
If an application required some geospatial capabilities, and visualizations I would use react-map-gl again. If the functional requirements extend beyond visualization into a lot of interactivity including custom layers I would look to use another library - react-mapbox-gl.
🌐
npm
npmjs.com › package › react-map-gl
react-map-gl - npm
3 weeks ago - React components for MapLibre GL JS and Mapbox GL JS. Latest version: 8.1.1, last published: 19 days ago. Start using react-map-gl in your project by running `npm i react-map-gl`. There are 482 other projects in the npm registry using react-map-gl.
      » npm install react-map-gl
    
Published   Apr 11, 2026
Version   8.1.1
🌐
React Map GL
visgl.github.io › introduction
Introduction | react-map-gl
We also render WebGL graphic overlays on top of the map, most notably with deck.gl. In these use cases, in order for all components to synchronize correctly, they must have their shared states managed by React. We might store the source of truth in a parent component state, or Redux store, or hooks, and let it propagate down to the map as well as its peers. Ultimately, in the spirit of the reactive programming paradigm, data always flows down. As long as the map manages its own state, as mapbox-gl is designed to do, we risk the components going out of sync.
🌐
DEV Community
dev.to › sheenasany › how-to-use-mapbox-using-react-map-gl-v7-for-your-react-app-for-beginners-2o10
How to use Mapbox using React-Map-Gl V7 for your React App for beginners - DEV Community
November 1, 2022 - For more information on how to secure your Mapbox token, here's some more documentation on it as well as on the tokens themselves. You'll be calling this variable later so keep this in mind for now. That should be all the set-up we need for now. Let's get to coding. For our purposes here, we're going to start by simply showing the map and adding markers from our backend database. But first we want to set our initial viewport to where we want our app to load when first mounted on the browser.