[Answered ]-Mapbox add marker on click

1👍

When clicking event fires up, you can get the coordinates with e.lngLat , it gives you an object with two attributes of lat and lng. something like this :

map.on('click', (e) => {
    let coords = e.lngLat;
    let lat = coords.lat;
    let lng = coords.lng;
});

Leave a comment