javascript - React Redux 对象数组值未在组件中更新
问题描述
我正在尝试更新对象数组项的值,但reducer 已更新而不是在组件中呈现...你能帮忙吗?
case actionTypes.UPDATE_MAGAZINE_BOOKMARK:
const arrayObj = state.magazineListDetail;
const updateMagazine = state.magazineListDetail.data
.map(function(x) {
return x.id;
})
.indexOf(action.magazineList);
let newMagazineArray = [...state.magazineListDetail.data];
newMagazineArray[updateMagazine] = {
...newMagazineArray[updateMagazine],
isBookmark: !newMagazineArray[updateMagazine].isBookmark
};
arrayObj.data = newMagazineArray;
return {
...state,
magazineListDetail: newMagazineArray
};
提前致谢
解决方案
推荐阅读
- acumatica - 删除和更新 PXDatabase 中的数据库
- android - React Native,智能手机和安卓模拟器之间的性能
- angularjs - AngularJS 纯 ng-controller 生命周期钩子
- vb6 - VB6标签最大字符串长度?
- logging - 查看脚本日志显示“未找到日志。使用 Logger API 将日志添加到您的项目。”
- cakephp - Cakephp 3.6 Paginator->sortDir() 仅显示“asc”
- jquery - 嵌套折叠每次调用父折叠
- sql - SQL Server - 使用来自多个结果集的行创建视图
- r - dplyr 中使用 stri_detect_regex 的正则表达式问题
- c++ - 当通过 cin 存储的数字为负时,为什么无符号整数会产生很大的输出?