You can see an example in pure javascript here:
https://docs.mapbox.com/mapbox-gl-js/example/cluster/
And how to build a similar app here:
https://levels.io/hoodmaps/