I try to do it but it doesn't work, below is my main code.
You need to query the features on the Mapbox map
map.on('click', (e) => {
const point = new mapboxgl.Point(e.pixel[0], e.pixel[1]);
const features = mbMap.queryRenderedFeatures(point);
console.log(features);
});
https://codesandbox.io/s/mapbox-layer-forked-x8mocy?file=/main.js