I have been trying to put marker of the locations , of the user saved in mongodb.
//Get Cordinates from ALL Farms
componentDidMount(){
const url="http://localhost:5000/api/users/viewFarm/5d3ac84a86688123789e13b2";
fetch (url,{
method: "GET"
}).then(response=> response.json()).then(result=>{
console.log(result);
this.setState({
farmList : result
});
});
}
The response from backend server for the location of the user
[
[
"11.33,22.99"
],
[],
[
"11.22,65.33"
],
[
"32131"
],
[
"32161"
],
[
"2"
],
[
"Location"
]
]
Here i can parse the get request and get locations but how to pass the location all the farms in the Leaflet map.
<Marker position={[23.54474, 87.29164]}>
<Popup>
Test Popup
</Popup>
</Marker>
[ [ "11.33,22.99" ], [], [ "11.22,65.33" ], [ "32131" ], [ "32161" ], [ "2" ], [ "Location" ] ]