'ReactLeafletDriftMarker not drifting

Good day,

I have a map with markers that move every 3 seconds to a new location, using ReactLeafletDriftMarker. I cannot, unfortunately, share my code since it is confidential.

My issue is that the markers do not drift, they just jump/appear in the next location.

Does anyone know what causes this to happen?

I can share this snippet:

{Object.entries(latlng).map(([key, value]) => {
          return (
            <ReactLeafletDriftMarker
              position={value}
              duration={4000}
              keepAtCenter={false}
              icon={markerIcon}
            >
            </ReactLeafletDriftMarker>
          );
        })}

It shows how (around) 400 points move on a map.

All help is appreciated, thanks.



Solution 1:[1]

It was a simple mistake. I assigned a key to the container, so it re-rendered every time the markers changed position values.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 CarlaVdB