Error: Invalid LatLng object: (undefined, undefined) #13
-
Describe the bug
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hello @MoussaRiad, const [currentTrack, setCurrentTrack] = useState({}); In my example, the "currentTrack" is an object not an array, it represents one coordinate of your marker, latitude and longitude, defined by an object with two properties, "lat" and "lng". I then destructure this "data" object and send its "lat" and "lng" values to the tracking marker as an array (see the code snippet bellow) But this is just my example, you can handle your data differently in your project as long as you make sure that you are sending the "position" and "prevPos" to **LeafletTrackingMarker ** in the required format. <LeafletTrackingMarker icon={icon} position={[latitude, longitude]} previousPosition={[previousLatitude, previousLongitude]} /> |
Beta Was this translation helpful? Give feedback.
Hello @MoussaRiad,
In my example, the "currentTrack" is an object not an array, it represents one coordinate of your marker, latitude and longitude, defined by an object with two properties, "lat" and "lng".
I then destructure this "data" object and send its "lat" and "lng" values to the tracking marker as an array (see the code snippet bellow)
But this is just my example, you can handle your data differently in your project as long as you make sure that you are sending the "position" and "prevPos" to **LeafletTrackingMarker ** in the required format.