【发布时间】:2021-07-07 22:32:02
【问题描述】:
当 API 调用时,我将对象发送到后端(Node js)。但我使用控制台日志检查对象。我用邮递员检查过。当我检查 POSTMAN 时,我工作得很好。但是我尝试在前端(react js)中传递一个对象,它显示为未定义。
getnotification(){
const userdetails={
userid:"1235",
username:this.state.name
}
axios.get('http://localhost:4000/notification/',userdetails)
.then((res)=>{ this.setState((cur) => ({ ...cur, notification: res.data.reverse() }));
})
}
【问题讨论】: