Javascript 如何在reactjs中使用axios get方法获取对象数据?

Javascript 如何在reactjs中使用axios get方法获取对象数据?,javascript,reactjs,Javascript,Reactjs,我有一个API&现在我能够像API一样获得字符串数据 salonName&\u id但无法获取api中给定的对象值,如LadiesServices&GentsServices 我该怎么做 反应代码:- 状态={ 沙龙:[] } componentDidMount(){ axios.get()http://localhost:3001/renderData)。然后(response=>response.data) 。然后((数据)=>{ this.setState({salons:data})

我有一个API&现在我能够像API一样获得字符串数据
salonName
&
\u id
但无法获取api中给定的对象值,如
LadiesServices
&
GentsServices

我该怎么做

反应代码:-

状态={
沙龙:[]
}
componentDidMount(){
axios.get()http://localhost:3001/renderData)。然后(response=>response.data)
。然后((数据)=>{
this.setState({salons:data})
console.log(this.state.salongs)
})
}
render(){
返回(
{this.state.salones.map((salon)=>(
{沙龙_id}

{沙龙.\u沙龙名称}

{salon.LadiesServices}

{salon.gentservices}

))} )
}
{salon.\u salonName}

-在数据模板字段中,不带下划线。GentsServices-是一个对象。如果您希望像这样渲染字符串,则需要使用JSON.stringify,因为默认情况下React无法渲染对象