也许问题可能太简单但我无法获取数据
这是 API 的响应:
[{"city_id": 33, "city_name": "Nagpur", "country_id": 1, "country_name": "India", "entity_id": 33, "entity_type": "city", "latitude": 21.15, "longitude": 79.09, "title": "Nagpur"}]
此响应存储在“a”中,现在当我设置状态时,
this.setState({lat: a})
它在日志中显示相同的数据,但是当我尝试提取纬度和经度时,它显示未定义。我这样做是为了提取数据
this.setState({lat : a.latitude}) // shows undefined
请帮我 !!!!!!