当前位置:网站首页>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;
}
}
边栏推荐
- 杂七杂八的东东
- How to build a data application system based on overall value for energy enterprises
- Haas506 2.0 development tutorial - Advanced Component Library -modem Voicecall (only supports versions above 2.2)
- Sklearn classification in sklearn_ Report & accuracy / recall /f1 value
- haas506 2.0开发教程-高级组件库-modem.voiceCall(仅支持2.2以上版本)
- QT creator builds osgearth environment (osgqt msvc2017)
- Haas506 2.0 development tutorial - Advanced Component Library -modem Net (only supports versions above 2.2)
- Haas506 2.0 development tutorial -hota (only supports versions above 2.2)
- Day_ 10 smart health project - permission control, graphic report
- 如何查看本机IP
猜你喜欢

了解学习 JSX 的工作方式

Get to know webassembly quickly

Measurement principle and thickness measurement mode of spectral confocal
百度URL參數之LINK?URL參數加密解密研究(代碼實例)

把CSMA/CD、Token Bus、Token Ring说清楚

综合培养学生脑力思维的少儿编程

bootstrap如何清除浮动的样式

Day_ 09 smart health project - mobile terminal development - Mobile quick login and permission control

Data indicators and data analysis models that designers need to understand

C # database reports errors. Let's have a look
随机推荐
Laravel log channel grouping configuration
Smart port: how to realize intelligent port supervision based on the national standard gb28181 protocol easygbs?
Functions and basic structure of CPU
Drawing and resetting of mars3d point, line and surface
综合培养学生脑力思维的少儿编程
记一次GLIB2.14升级GLIB2.18的记录以及其中的步骤原理
minio单节点部署 minio分布式部署 傻瓜式部署过程 (一)
Topic35——34. Find the first and last positions of elements in a sorted array
Understand how learning JSX works
Haas506 2.0 development tutorial -sntp (only versions above 2.2 are supported)
English语法_副词 - ever / once
Synchronous switching power supply reduces EMI layout dv/dt di/dt
光谱共焦的测量原理及厚度测量模式
Sword finger offer 42 Maximum sum of successive subarrays
Haas506 2.0 development tutorial - Advanced Component Library -modem Sim (only supports versions above 2.2)
2020 smart power plant industry insight white paper
问题:访问组件中数据object(定义的数据)中属性也为object对象中的属性时,报错现象
Fastdata pole | insight report on e-commerce consumption of young Chinese users 2021
20220621 Three Conjugates of Dual Quaternions
Laravel log channel 分组配置