mirror of
https://github.com/visgl/react-map-gl.git
synced 2025-12-08 20:16:02 +00:00
29 lines
711 B
JavaScript
29 lines
711 B
JavaScript
/* global document */
|
|
import * as React from 'react';
|
|
import {createRoot} from 'react-dom/client';
|
|
import Map, {Marker} from 'react-map-gl/mapbox';
|
|
|
|
import 'mapbox-gl/dist/mapbox-gl.css';
|
|
|
|
const MAPBOX_TOKEN = ''; // Set your mapbox token here
|
|
|
|
function Root() {
|
|
return (
|
|
<Map
|
|
initialViewState={{
|
|
latitude: 37.8,
|
|
longitude: -122.4,
|
|
zoom: 14
|
|
}}
|
|
style={{width: 800, height: 600}}
|
|
mapStyle="mapbox://styles/mapbox/streets-v9"
|
|
mapboxAccessToken={MAPBOX_TOKEN}
|
|
>
|
|
<Marker longitude={-122.4} latitude={37.8} color="red" />
|
|
</Map>
|
|
);
|
|
}
|
|
|
|
const root = createRoot(document.body.appendChild(document.createElement('div')));
|
|
root.render(<Root />);
|