【发布时间】:2017-12-21 11:12:08
【问题描述】:
async editSurvey(answers) {
let answer_text;
let id;
answers.map((answer, index) => {
answer_text = answer.answer_text;
id = answer.id;
});
body: JSON.stringify({
question: {
answers_attributes: {
'0': {
answer_text: answer_text,
id: id
} }
}
})
}
这是 api 代码,我想要 map 函数,以便在每张地图上它都应该转到 JSON.stringify 并分配值,但在我的情况下,它会转到 JSON.stringify 作为最后一个地图元素。所以请建议我任何解决方案。 提前谢谢你。
【问题讨论】:
标签: json reactjs api react-native