使用以下方法,能够避免一些问题
/**
* index: 数据在list中的位置
**/
setTableList(prevList => {
const list = [...prevList];
list[index].name = newName;
list[index].phone = `+86 ${list[index].phone} `;
return list;
});
使用以下方法,能够避免一些问题
/**
* index: 数据在list中的位置
**/
setTableList(prevList => {
const list = [...prevList];
list[index].name = newName;
list[index].phone = `+86 ${list[index].phone} `;
return list;
});
本文标题:setState
本文链接:https://www.haomeiwen.com/subject/jdqjrrtx.html
网友评论