问题描述
我在React Native App中有一个项目列表。
最初,项目的“ id” 存储在对象数组中。
每次单击一个项目时,该项目的ID都会从数组中删除。 删除ID的代码:
let found = this.state.genList.find((a) => a.id === item.id);
let index = this.state.genList.indexOf(found);
if (index > -1) {
this.state.genList.splice(index,1);
}
AsyncStorage.setItem('general_messages',this.state.genList);
使用接头,借助索引将其删除。
这仅适用一次。
下次单击某项时,出现以下错误。
为什么“ 拼接”会导致此问题?
我还能怎么写呢?
请帮忙!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)