【发布时间】:2020-12-15 18:11:20
【问题描述】:
我有以下代码
const onSubmit = data => {
let params = {
experience_type: data.education[0].type,
body: data.education[0].text,
start_time: data.education[0].from,
end_time: data.education[0].to,
}
axios.post('http://localhost:5000/experience', params)
.then((response) => {
console.log(response);
}, (error) => {
console.log(error);
});
};
我想使用 Axios 发布整个 data.education 数组。目前我只能发布第一个索引。我将如何使用 axios 发布 data.education 数组的所有索引。我目前的想法是使用扩展运算符并单独传递每个运算符。
【问题讨论】:
-
嘿..你能分享你的数据库模型代码吗
-
请 console.log(data) 分享结果
标签: node.js reactjs post axios