0

The problem: The map doesn´t update.

Hello!

I´m trying to make a button that will toggle on/off map clustering. I followed the example here:https://visgl.github.io/react-map-gl/examples/clusters.

I whant to be able to toggle it, like this example on deck.gl: https://deck.gl/examples/icon-layer/

For the sake of simplicity, i just created a setTimeout on this map to cluster off on Source component. Here is the CodeSandBox: https://codesandbox.io/s/charming-flower-ud0pyu?file=/src/App.tsx

On my example, I made a toggle variable using useState: const [toggleCluster, setToggleCluster] = useState(true);

On useEffect, I set the clustering off by using setToggleCluster(false)

I´m using maplibre, maybe it wont provide some properties on map?

Any help on how to achieve this?

I don´t want to go to deck.gl because it is more complex and I have other controls already made for this component on react-map-gl.

Thanks!

nicmano
  • 123
  • 2
  • 12

0 Answers0