Node.js 如何在reactjs中的传单地图上标记位置[]?
Node.js 如何在reactjs中的传单地图上标记位置[]?,node.js,reactjs,mongodb,leaflet,Node.js,Reactjs,Mongodb,Leaflet,我一直在尝试将保存在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
我一直在尝试将保存在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
});
});
}
后端服务器对用户位置的响应
[
[
"11.33,22.99"
],
[],
[
"11.22,65.33"
],
[
"32131"
],
[
"32161"
],
[
"2"
],
[
"Location"
]
]
在这里,我可以解析get请求并获取位置,但是
如何通过传单地图中所有农场的位置
<Marker position={[23.54474, 87.29164]}>
<Popup>
Test Popup
</Popup>
</Marker>
测试弹出窗口
您的响应是什么样的?@kboul响应包含特定用户在数组中的位置[[“11.33,22.99”]、[]、[“11.22,65.33”]、[“32131”]、[“32161”]、[“2”]、[“位置”]