当前位置:网站首页>redux Actions may not have an undefined “type“ property. Have you misspelled a constant?
redux Actions may not have an undefined “type“ property. Have you misspelled a constant?
2022-06-23 05:37:00 【天渺工作室】
react-redux 报错
Actions may not have an undefined "type" property. Have you misspelled a constant?出现类似的错误,很大几率是因为redux 操作action 动作时候的type 名称问题


检查action 中的type 是否和reducer 操作中的type 名称是一致
两处用到的 type 需要一致
// ./action.js
// 类型为type:types.USER
export const userAction=(data)=>({type:"类型名称",data});
// ./reducer.js
let token =null;
export default function Token(_token=token,action){
//解构中的type用来做判断条件
const {type,data}=action;
switch(type){
case "判断条件":
return data;
default:
return _token;
}
}
边栏推荐
- mars3d点线面的绘制和重置
- Test of ers function under the supplier consignment purchase mode of SAP mm
- haas506 2.0开发教程-高级组件库-modem.net(仅支持2.2以上版本)
- 2020 smart power plant industry insight white paper
- Get to know webassembly quickly
- MySQL5.6 (5.7-8) 基于shardingsphere5.1.1 Sharding-Proxy模式读写分离
- 常见设置模式(抽象工厂&责任链模式&观察者模式)
- 杂七杂八的东东
- bootstrap如何清除浮动的样式
- QT creator builds osgearth environment (osgqt msvc2017)
猜你喜欢

C# wpf 附加属性实现界面上定义装饰器

Explain csma/cd, token bus and token ring clearly

Synchronous switching power supply reduces EMI layout dv/dt di/dt

Laravel log channel grouping configuration

Haas506 2.0 development tutorial -hota (only supports versions above 2.2)

Data indicators and data analysis models that designers need to understand

如何实现与FDA保持邮件通信安全加密?

Sklearn classification in sklearn_ Report & accuracy / recall /f1 value

haas506 2.0开发教程-hota(仅支持2.2以上版本)

Programmers' real ideas | daily anecdotes
随机推荐
云盒子联合深信服,为南京一中打造智慧双模教学资源分享平台
Open source to the world (Part 2): the power of open source from the evolution of database technology BDTC 2021
c#数据库报错问题大家帮我看看吧
20220621 Three Conjugates of Dual Quaternions
如何实现与FDA保持邮件通信安全加密?
mingw-w64、msys和ffmpeg的配置与编译
剑指 Offer 42. 连续子数组的最大和
Softing dataFEED OPC Suite将西门子PLC数据存储到Oracle数据库中
C Advanced Learning -- Reflection
Get to know webassembly quickly
原址 交换
Haas 506 2.0 Tutoriel de développement - bibliothèque de composants avancés - modem. SMS (ne prend en charge que les versions supérieures à 2,2)
Open source ecology 𞓜 super practical open source license basic knowledge literacy post (Part 2)
Verilog语法讲解
Easy EDA #学习笔记09# | ESP32-WROOM-32E模组ESP32-DevKitC-V4开发板 一键下载电路
XShell7 下载
【已解决】“The Unity environment took too long to respond. Make sure that :\n“
光谱共焦的测量原理及厚度测量模式
将TensorFlow1.x改写为pytorch
MySQL ON DUPLICATE KEY 和 PgSQL ON CONFLICT(主键) 处理主键冲突