I'm working on a react application with mapbox-gl for the first time and I have the same question. I would transition over to react-map-gl or react-mapbox-gl, but I haven't found any compelling reasons to. So far, plain mapbox-gl and redux have been a powerful combo and I've had no issues linking map state to the general application's state. This could be my person bias coming from a lack of react experience and working previously with leaflet.js, but I'd love to hear any other perspectives Answer from Reedfiend on reddit.com
🌐
GitHub
github.com › visgl › react-map-gl
GitHub - visgl/react-map-gl: React friendly API wrapper around MapboxGL JS · GitHub
// Using Maplibre import * as React from 'react'; import Map from 'react-map-gl/maplibre'; import 'maplibre-gl/dist/maplibre-gl.css'; function App() { return ( <Map initialViewState={{ longitude: -122.4, latitude: 37.8, zoom: 14 }} style={{width: 600, height: 400}} mapStyle="https://api.maptiler.com/maps/streets/style.json?key=<Maptiler access token>" /> ); } ... // Using Mapbox import * as React from 'react'; import Map from 'react-map-gl/mapbox'; import 'mapbox-gl/dist/mapbox-gl.css'; function App() { return ( <Map // https://visgl.github.io/react-map-gl/docs/get-started/mapbox-tokens mapboxAccessToken="<Mapbox access token>" initialViewState={{ longitude: -100, latitude: 40, zoom: 3.5 }} style={{width: 600, height: 400}} mapStyle="mapbox://styles/mapbox/streets-v9" /> ); }
Starred by 8.4K users
Forked by 1.4K users
Languages   TypeScript 65.5% | JavaScript 32.2%
🌐
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.
Discussions

When to use react-map-gl or plain mapbox-gl in React app?
I'm working on a react application with mapbox-gl for the first time and I have the same question. I would transition over to react-map-gl or react-mapbox-gl, but I haven't found any compelling reasons to. So far, plain mapbox-gl and redux have been a powerful combo and I've had no issues linking map state to the general application's state. This could be my person bias coming from a lack of react experience and working previously with leaflet.js, but I'd love to hear any other perspectives More on reddit.com
🌐 r/gis
5
9
October 13, 2021
question: Considerably lower FPS with react-map-gl compared to mapbox-gl
I'm having a considerably lower frame rate with react-map-gl components compared to only using mapbox-gl. In Chrome, sometimes rendering takes twice as much time with react-map-gl. I had better res... More on github.com
🌐 github.com
13
July 13, 2020
Comparison to Uber's react-map-gl
has anyone compared this to react-map-gl by uber? if so, what were your findings? for example we are skeptical of building the style object and passing it in to control everything instead of using ... More on github.com
🌐 github.com
15
January 10, 2017
Mapbox blank map React-map-gl | ReactJS
As I understand it, the cause is that mapbox (not react-map-gl) has a bug in it that does not transpile correctly with "npm build". Fortunately you do NOT have to eject your app as I learned in this link: https://github.com/mapbox/mapbox-gl-js/issues/10173#issuecomment-753662795 More on stackoverflow.com
🌐 stackoverflow.com
🌐
React Map GL
visgl.github.io › introduction
Introduction | react-map-gl
In v7.0, react-map-gl was fully rewritten to better align its API with the underlying Mapbox GL JS library.
🌐
Reddit
reddit.com › r/gis › when to use react-map-gl or plain mapbox-gl in react app?
r/gis on Reddit: When to use react-map-gl or plain mapbox-gl in React app?
October 13, 2021 -

I'm working on a React app with a mapbox component and am trying to understand the use case for react-map-gl vs the examples on the Mapbox site that just use mapbox-gl. From the React GitHub issues they mention this in regards to performance -

React may decide to render more than necessary than Mapbox would on its own, failing to account for how expensive the draw call is.

If you are using mapbox as nothing but a map display, generally speaking you do not need this library. If you are trying to match the map with any other React component, you will eventually run into the same issue.

But then the entire Mapbox studio is written I believe without any react wrappers...and there are plenty of React components in Studio besides the map, so it does not seem like this argument holds true. Anyone have thoughts or experience they can share?

🌐
GitHub
github.com › visgl › react-map-gl › issues › 1151
question: Considerably lower FPS with react-map-gl compared to mapbox-gl · Issue #1151 · visgl/react-map-gl
July 13, 2020 - I'm having a considerably lower frame rate with react-map-gl components compared to only using mapbox-gl. In Chrome, sometimes rendering takes twice as much time with react-map-gl.
Author   benknab
🌐
npm
npmjs.com › package › react-map-gl
react-map-gl - npm
2 weeks ago - React components for MapLibre GL JS and Mapbox GL JS. Latest version: 8.1.1, last published: 12 days ago. Start using react-map-gl in your project by running `npm i react-map-gl`. There are 480 other projects in the npm registry using react-map-gl.
      » npm install react-map-gl
    
Published   Apr 11, 2026
Version   8.1.1
🌐
Mapbox
mapbox.com › blog › mapbox-gl-js-react
Mapbox GL JS + React
August 13, 2025 - I hope this helps as a primer on using Mapbox GL JS alongside React and provides some context for how we achieve a few different concepts here at Mapbox. To suggest improvements to any of these demos or to learn more visit https://github.com/mapbox/mapbox-react-examples/
Find elsewhere
🌐
GitHub
github.com › urbica › react-map-gl
GitHub - urbica/react-map-gl: React Component Library for Mapbox GL JS · GitHub
Mapbox uses access tokens to associate requests to API resources with your account. You can find all your access tokens, create new ones, or delete existing ones on your API access tokens page. See Documentation for more examples. By default, MapGL component renders in a static mode. That means that the user cannot interact with the map. import React from 'react'; import MapGL from '@urbica/react-map-gl'; import 'mapbox-gl/dist/mapbox-gl.css'; <MapGL style={{ width: '100%', height: '400px' }} mapStyle='mapbox://styles/mapbox/light-v9' accessToken={MAPBOX_ACCESS_TOKEN} latitude={37.78} longitude={-122.41} zoom={11} />;
Starred by 424 users
Forked by 49 users
Languages   JavaScript
🌐
npm
npmjs.com › package › react-mapbox-gl
react-mapbox-gl - npm
November 26, 2020 - map · webgl · mapbox-gl · react-component · npm i react-mapbox-gl · github.com/alex3165/react-mapbox-gl · github.com/alex3165/react-mapbox-gl#readme · 55,087 · 5.1.1 · MIT · 496 kB · 174 · 5 years ago · alex3165 · mklopets · philpl · ddhauser ·
      » npm install react-mapbox-gl
    
Published   Nov 26, 2020
Version   5.1.1
Author   Alexandre Rieux
🌐
GitHub
github.com › alex3165 › react-mapbox-gl
GitHub - alex3165/react-mapbox-gl: A React binding of mapbox-gl-js · GitHub
// ES6 import ReactMapboxGl, { Layer, Feature } from 'react-mapbox-gl'; import 'mapbox-gl/dist/mapbox-gl.css'; // ES5 var ReactMapboxGl = require('react-mapbox-gl'); var Layer = ReactMapboxGl.Layer; var Feature = ReactMapboxGl.Feature; require('mapbox-gl/dist/mapbox-gl.css'); const Map = ReactMapboxGl({ accessToken: 'pk.eyJ1IjoiZmFicmljOCIsImEiOiJjaWc5aTV1ZzUwMDJwdzJrb2w0dXRmc2d0In0.p6GGlfyV-WksaDV_KdN27A' }); // in render() <Map style="mapbox://styles/mapbox/streets-v9" containerStyle={{ height: '100vh', width: '100vw' }} > <Layer type="symbol" id="marker" layout={{ 'icon-image': 'marker-15' }}> <Feature coordinates={[-0.481747846041145, 51.3233379650232]} /> </Layer> </Map>; 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.
Starred by 2K users
Forked by 533 users
Languages   TypeScript 93.7% | CSS 3.1% | HTML 2.5%
🌐
npm Trends
npmtrends.com › mapbox-gl-vs-react-map-gl-vs-react-mapbox-gl
mapbox-gl vs react-map-gl vs react-mapbox-gl | npm trends
Comparing trends for mapbox-gl 3.16.0 which has 1,892,414 weekly downloads and 11,969 GitHub stars vs. react-map-gl 8.1.0 which has 931,499 weekly downloads and 8,306 GitHub stars vs. react-mapbox-gl 5.1.1 which has 74,683 weekly downloads and 1,991 GitHub stars.
🌐
React Map GL
visgl.github.io › what's new
What's new | react-map-gl
First version to support Mapbox GL JS' official types and MapLibre GL JS v5. This version fully separates the code that support each compatible map library: react-map-gl/mapbox: for use with mapbox-gl>=3.5.0
🌐
GitHub
github.com › mapbox › react-map-gl
GitHub - mapbox/react-map-gl: React friendly API wrapper around MapboxGL JS
Because most of the functionality of Mapbox's JS API depends on the use of HTML5 canvases and WebGL, which React is not built to manipulate, the React component does not mirror all the functionality of Mapbox GL JS's Map class.
Starred by 5 users
Forked by 3 users
Languages   JavaScript 85.7% | CSS 12.6% | JavaScript 85.7% | CSS 12.6%
🌐
GitHub
github.com › alex3165 › react-mapbox-gl › issues › 97
Comparison to Uber's react-map-gl · Issue #97 · alex3165/react-mapbox-gl
January 10, 2017 - has anyone compared this to react-map-gl by uber? if so, what were your findings? for example we are skeptical of building the style object and passing it in to control everything instead of using ...
Published   Jan 10, 2017
🌐
React Map GL
visgl.github.io › react-map-gl › examples
react-map-gl
Mapbox · Clusters · Markers, Popups and Controls · Custom Cursor · Draggable Marker · Draw Polygon · Highlight By Filter · Geocoder · GeoJSON Animation · GeoJSON · Heatmap · Limit Map Interaction · Dynamic Styling · Side by Side · Terrain · Camera Transition ·
🌐
CodeSandbox
codesandbox.io › examples › package › react-map-gl
react-map-gl examples - CodeSandbox
visgl/react-map-gl: nextjs · Find more examples or templates · AboutReact components for MapLibre GL JS and Mapbox GL JS1,428,414Weekly Downloads · Latest version8.1.1 · LicenseMIT · External Links · github.com/visgl/react-map-gl ·
Top answer
1 of 7
21

I know this is an old post..

As I understand it, the cause is that mapbox (not react-map-gl) has a bug in it that does not transpile correctly with "npm build".

Fortunately you do NOT have to eject your app as I learned in this link: https://github.com/mapbox/mapbox-gl-js/issues/10173#issuecomment-753662795

I had to npm install worker-loader

Then add the following lines.

    // had this.
    import ReactMapGL, { FlyToInterpolator, NavigationControl } from 'react-map-gl';    import 'mapbox-gl/dist/mapbox-gl.css';


    // added the following 6 lines.
    import mapboxgl from 'mapbox-gl';

    // The following is required to stop "npm build" from transpiling mapbox code.
    // notice the exclamation point in the import.
    // @ts-ignore
    // eslint-disable-next-line import/no-webpack-loader-syntax, import/no-unresolved
    mapboxgl.workerClass = require('worker-loader!mapbox-gl/dist/mapbox-gl-csp-worker').default;

Since I'm using typescript and linting, I had to add some directives to ignore warnings/errors that would otherwise stop it from compiling.

Note that I did not have to install mapboxgl since react-map-gl uses it.

But, I did need to add eslint-disable-next-line import/no-unresolved

and eslint-disable-next-line import/no-webpack-loader-syntax combined on the same line.

I am using "react-map-gl": "^6.1.17".

2 of 7
4

The issue is caused by the transpiler. It's a bug that Mapbox is working on. Follow the suggestions here:

https://github.com/mapbox/mapbox-gl-js/issues/10173

It's also in the official documentation now.

https://docs.mapbox.com/mapbox-gl-js/api/#transpiling-v2

🌐
Best of JS
bestofjs.org › projects › react-map-gl
Best of JS • react-map-gl
React friendly API wrapper around MapboxGL JS · React · Maps · WebGL · visgl/react-map-glvisgl.github.io/react-map-glreact-map-gl · Loading data... README · Loading README.md ·
🌐
GitHub
github.com › topics › react-mapbox-gl
react-mapbox-gl · GitHub Topics · GitHub
typescript react-mapbox-gl openweathermap-api google-maps-api weather-app weather-application tailwindcss react-hot- next-themes weather-app-react shadcn-ui nextjs14 react-hotkeys-hook