我试图实现对Node JS的POST调用,但是在得到响应后,它又在不断地调用。由于这个原因,状态正在刷新。我是React的新手,请给予建议。
axios({
method: 'post',
url: '/api/project/create',
headers: {
"Accept": "application/json",
'content-type': 'application/json'
},
data: data
})
.then(response => {
setResCode({resCode: response.statusCode}) // Due to this line, my axios is starts calling again and again
})