在减速器中的这种上下文中更新状态的更好方法是什么?
case DELETE_INTEREST:
let deleteInterests = state.user.interests;
let index = deleteInterests.findIndex(i => i == action.payload);
deleteInterests.splice(index, 1);
return { ...state, user: { ...state.user, interests: deleteInterests } };
ESLint 不喜欢 reducer 中 case 块内的 let 语句,得到:
eslint: no-case-declaration - case 块中的意外词法声明