JSFiddle - React, Tailwind, and code Playground

by Tristen Brown

HTML

<link rel="stylesheet" href="https://api.mapbox.com/mapbox-assembly/mbx/v1.2.0/assembly.min.css">
<link rel="stylesheet" href="https://api.mapbox.com/mapbox-gl-js/v3.5.1/mapbox-gl.css">
<div id="map" class="absolute top bottom left right w-full"></div>

JavaScript

mapboxgl.accessToken = 'pk.eyJ1IjoidHJpc3RlbiIsImEiOiJjajZoOXU4Z2kwNnppMnlxd2d6bTFvZ2xtIn0.PP7AoUakMfeqdXFHdsY0oA';

const style = {
  "version": 8,
  "center": [9, 12],
  "zoom": 5,
  "sources": {
    "composite": {
      "url": "mapbox://mapbox.mapbox-streets-v8",
      "type": "vector"
    }
  },
  "sprite": "mapbox://sprites/tristen/cm10ux9qq002501pce4d0h5wo/draft",
  "glyphs": "mapbox://fonts/mapbox/{fontstack}/{range}.pbf",
  "projection": {
    "name": "globe"
  },
  "layers": [{
      "id": "place-label",
      "type": "heatmap",
      "source": "composite",
      "source-layer": "place_label",
      "layout": {},
      "paint": {}
    },
    {
      "id": "landuse",
      "type": "fill",
      "source": "composite",
      "source-layer": "landuse",
      "layout": {},
      "paint": {}
    }
  ]
};

const map = new mapboxgl.Map({
  container: 'map',
  style
});