Skip to content

Instantly share code, notes, and snippets.

@Misfit-Ha
Misfit-Ha / SimpleMap.jsx
Last active May 14, 2023 18:17
Highlight every road inside an area using React-leaflet
import { MapContainer, Polyline, TileLayer } from 'react-leaflet'
import 'leaflet/dist/leaflet.css'
import 'leaflet-defaulticon-compatibility/dist/leaflet-defaulticon-compatibility.webpack.css' // Re-uses images from ~leaflet package
import { useState } from 'react'
export default function SimpleMap() {
const [roads, setRoads] = useState([])
const clickHandler = async () => {