You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
3
+
This is supporting code for the Mapbox tutorial [Use Mapbox GL JS in an React app](https://docs.mapbox.com/help/tutorials/use-mapbox-gl-js-with-react/).
4
4
5
-
Currently, two official plugins are available:
5
+
## Overview
6
6
7
-
-[@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh
8
-
-[@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
7
+
This tutorial walks through how to setup [Mapbox GL JS](https://docs.mapbox.com/mapbox-gl-js/) in an [React](https://react.dev) project.
9
8
10
-
## Expanding the ESLint configuration
11
9
12
-
If you are developing a production application, we recommend using TypeScript with type-aware lint rules enabled. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) for information on how to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project.
10
+
You'll learn how to:
11
+
- Setup a Vite JS app to use React
12
+
- How to install Mapbox GL JS and its dependencies.
13
+
- Use Mapbox GL JS to render a full screen map.
14
+
- How to add a toolbar which displays map state like `longitude`, `latitude`, and `zoom` level and is updated as the map is interacted with (showing the map to app data flow).
15
+
- How to create a UI button to reset the map to its original view (showing the app to map data flow).
16
+
17
+
18
+
## Prerequisites
19
+
20
+
- Node v18.20 or higher
21
+
- npm
22
+
23
+
## How to run
24
+
25
+
- Clone this repository and navigate to this directory
26
+
- Install dependencies with `npm install`
27
+
- Replace `YOUR_MAPBOX_ACCESS_TOKEN` in `src/App.jsx` with an access token from your [Mapbox account](https://console.mapbox.com/).
28
+
- Run the development server with `npm run dev` and open the app in your browser at [http://localhost:5173](http://localhost:5173).
0 commit comments