
Security News
GPT-6 Astra Attempts Supply Chain Attacks Against Open Source Maintainers in Testing
GPT-6 Astra hits 100% on ExploitBench and finds zero-days autonomously, while independent tests reveal scope violations and monitoring gaps.
react-mapbox-gl-cluster
Advanced tools
[](https://github.com/thuanmb/react-mapbox-gl-cluster/blob/master/LICENSE) [](https://www.npmjs.com/package/reac
The React component for the cluster layer in the mapbox-gl.
The cluster layer has some build-in actions:
This layer must be rendered inside react-mapbox-gl component.

Please note that the ReactMapboxGlCluster should be used together with the React wrapper of mapbox-gl e.g. react-mapbox-gl.
https://github.com/alex3165/react-mapbox-gl
import React, {Component} from 'react';
import ReactMapboxGl from 'react-mapbox-gl';
import {ReactMapboxGlCluster} from 'react-mapbox-gl-cluster';
import {data} from './data';
const Map = ReactMapboxGl({
accessToken: process.env.MAPBOX_GL_TOKEN,
});
const mapProps = {
center: [-95.7129, 37.0902],
zoom: [3],
style: 'mapbox://styles/mapbox/streets-v8',
};
class App extends Component {
getEventHandlers() {
return {
onClick: (properties, coords, offset) =>
console.log(`Receive event onClick at properties: ${properties}, coords: ${coords}, offset: ${offset}`),
onMouseEnter: (properties, coords, offset) =>
console.log(`Receive event onMouseEnter at properties: ${properties}, coords: ${coords}, offset: ${offset}`),
onMouseLeave: (properties, coords, offset) =>
console.log(`Receive event onMouseLeave at properties: ${properties}, coords: ${coords}, offset: ${offset}`),
onClusterClick: (properties, coords, offset) =>
console.log(`Receive event onClusterClick at properties: ${properties}, coords: ${coords}, offset: ${offset}`),
};
}
render() {
return (
<div className="App">
<Map {...mapProps} onStyleLoad={this.onStyleLoad}>
<ReactMapboxGlCluster data={data} {...this.getEventHandlers()} />
</Map>
</div>
);
}
}
data (object)
Data source for layer. It must to follow FeatureCollection geojson format
radius (number)
[Optional] Cluster radius, in pixels.
minZoom (number)
[Optional] Minimum zoom level at which clusters are generated.
maxZoom (number)
[Optional] Maximum zoom level at which clusters are generated.
extent (number)
Optional Tile extent. Radius is calculated relative to this value.
nodeSize (number)
[Optional] Size of the KD-tree leaf node. Affects performance.
pointClassName (string)
[Optional] The class name of each point.
pointStyles (object)
[Optional] The class name of each cluster.
clusterClassName (string)
[Optional] The class name of each cluster.
spiralComponent (element)
[Optional] The custom component for the spiral. Example usage:
const CustomSpiralComponent = ({properties, ...restProps}) => {
const onClick = e => {
console.log(`Receive event onClick in spiral at properties: ${JSON.stringify(properties)}`);
};
return <div className="spiderifier-marker-content" onClick={onClick}></div>;
};
...
<Map {...mapProps} onStyleLoad={this.onStyleLoad}>
<ReactMapboxGlCluster data={data} {...this.getEventHandlers()} spiralComponent={CustomSpiralComponent} />
</Map>
markerComponent (element)
[Optional] The custom component for marker. Example usage:
const CustomeMarkerComponent = ({properties, className, cssObject}) => {
const onClick = e => {
console.log(`Receive event onClick in marker at properties: ${JSON.stringify(properties)}`);
};
return <div className={className} style={cssObject} onClick={onClick} />;
};
...
<Map {...mapProps} onStyleLoad={this.onStyleLoad}>
<ReactMapboxGlCluster data={data} {...this.getEventHandlers()} markerComponent={CustomMarkerComponent} />
</Map>
clusterClickEnabled (bool) [Optional] Enable/disable zoom on cluster click
onClick (function)
[Optional] Handler for when user on marker
onMouseEnter (function)
[Optional] Handle when user move the mouse enter a point
onMouseLeave (function)
[Optional] Handle when user move the mouse leave a point
onClusterClick (function)
[Optional] Handle when user click on cluster
onClusterMouseEnter (function)
[Optional] Handle when user move the mouse enter a cluster
onClusterMouseLeave (function)
[Optional] Handle when user move the mouse leave a cluster
clusterClickEnabled flag to enable/disable on cluster click eventSupport custom marker.
const CustomeMarkerComponent = ({properties, className, cssObject}) => {
const onClick = e => {
console.log(`Receive event onClick in marker at properties: ${JSON.stringify(properties)}`);
};
return <div className={className} style={cssObject} onClick={onClick} />;
};
...
<Map {...mapProps} onStyleLoad={this.onStyleLoad}>
<ReactMapboxGlCluster data={data} {...this.getEventHandlers()} markerComponent={CustomMarkerComponent} />
</Map>
Support custom spiral.
const CustomSpiralComponent = ({properties, ...restProps}) => {
const onClick = e => {
console.log(`Receive event onClick in spiral at properties: ${JSON.stringify(properties)}`);
};
return <div className="spiderifier-marker-content" onClick={onClick}></div>;
};
...
<Map {...mapProps} onStyleLoad={this.onStyleLoad}>
<ReactMapboxGlCluster data={data} {...this.getEventHandlers()} spiralComponent={CustomSpiralComponent} />
</Map>
react, mapbox-gl, react-mapbox-gl, react-mapbox-gl-spiderifier....env fileREACT_APP_MAPBOX_GL_TOKEN into the .env fileyarn startyarn upgrade-interactive --latest
yarn startyarn buildpackage.jsonREADMEnpm publishFAQs
[](https://github.com/thuanmb/react-mapbox-gl-cluster/blob/master/LICENSE) [](https://www.npmjs.com/package/reac
The npm package react-mapbox-gl-cluster receives a total of 61 weekly downloads. As such, react-mapbox-gl-cluster popularity was classified as not popular.
We found that react-mapbox-gl-cluster demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.

Security News
GPT-6 Astra hits 100% on ExploitBench and finds zero-days autonomously, while independent tests reveal scope violations and monitoring gaps.

Product
Socket can now send alerts and supply chain attack notifications to Microsoft Teams, with filters that route the right updates to each channel.

Security News
pnpm 12 rewrites the package manager in Rust, cutting install times by up to 90% while preserving pnpm 11 workflows and lockfiles.