Vite and React quickstart
A map with its controls and one of your itineraries, in one React file.
The packages are not on npm yet
1
Create the app
2
Set your key
Create a publishable key under Organization → API keys in the Mountaya app, with the tiles and publishing scopes. A publishable key is safe in a browser bundle.
.env.local
Use the id of one of your published itineraries.
3
Replace src/main.tsx
src/main.tsx
4
Run it
Open the address Vite prints. The map opens on Chamonix, then frames your itinerary.
The controls sit inside MapView, so they find the map on their own. To read drafts or call the Data API from the page, add a session token. The examples/elements-react-map directory of the SDK repository does that.