Skip to main content

Clusterer component (advanced)

Use when you prefer a declarative component over useClusterer but still render your own map.

Import from /clusterer:

import { Clusterer } from 'react-native-better-clustering/clusterer'

Clusterer

Maps visible clustered features to React elements via renderItem.

<Clusterer
data={geoJsonPoints}
region={region}
mapDimensions={{ width: mapWidth, height: mapHeight }}
options={{ radius: 40, minPoints: 2, maxZoom: 20 }}
renderItem={(feature) => (
<MyMarker key={featureKey(feature)} feature={feature} />
)}
/>
PropTypeDescription
dataPointFeature[]Points to cluster (memoize with useMemo)
regionMapRegionCurrent map region
mapDimensions{ width, height }Map size in pixels
optionsSuperclusterOptionsOptional clustering options
renderItem(feature) => ReactElementRender each visible point or cluster

Thin adapter over useClusterer — same lifecycle, defaults, and performance notes apply. For full control, use the hook directly.