I tried the following link example
I want to add the popup on the cluster and show all the clustered data as HTML on that. I can see the popup but getting undefined on the popup content.
map.on('click', 'cluster', function (e) {
let description = "";
for(let i = 0; i < e.features.length; i++) {
description = description + e.features[i].properties.description;
if(i != e.features.length - 1) {
description = description + "</br>";
}
}
new mapboxgl.Popup()
.setLngLat(e.features[0].geometry.coordinates)
.setHTML(description )
.addTo(map);
});