Geocode react leaflet

298 views Asked by At

Trying to add an address list in ELG.geocode. error: Cannot read property '0' of undefined; (results)
Original: https://codesandbox.io/s/geocoding-in-react-leaflet-v3x-forked-uilpl?file=/src/MyMap.jsx:632-725

    ELG.geocode()
        .text(address)
        .run((err, results, response) => {
            console.log(results.results[0].latlng);
            const { lat, lng } = results.results[0].latlng;
            map.setView([lat, lng], 12);
            L.marker([lat, lng])
                .addTo(map)
                .bindPopup(address)
                .openPopup();
        });

    return null;
0

There are 0 answers