[Redux] Avoid action type naming conflicts
2024-08-23 14:37:47
In redux, the action type is just a normal string type, it is easy to get naming conflicts in large application.
Can use namespace-constants lib to solve the problem: https://npmdaily.com/pkg/namespace-constants
import constants from 'namespace-constants'; module.exports = constants('todos', [
'ADD_TODO',
'REMOVE_TODO',
'TOGGLE_TODO'
]);
// {
// 'ADD_TODO': 'todos:ADD_TODO',
// 'REMOVE_TODO': 'todos:REMOVE_TODO'
// 'TOGGLE_TODO': 'todos:TOGGLE_TODO'
// }
最新文章
- 一次发现underscore源码bug的经历以及对学术界『拿来主义』的思考
- Hibernate对象标识符
- mongo-c-driver使用VS2013编译
- [团队项目]Scrum 项目1.0 (演说视频)NABCD
- iOS7 中的statusbar的隐藏和样式更改
- linux之pid文件
- WPF基础到企业应用系列7——深入剖析依赖属性(WPF/Silverlight核心)
- canvas-js贝塞尔曲代码在线生成工具
- uva - Broken Keyboard (a.k.a. Beiju Text)(链表)
- Matlab立体标定mat转换成Opencv的CvMat
- 树状数组(瞎bb) [树状数组]
- OpenWRT添加模块 Makefile和Config.in
- 浅谈Google Chrome浏览器(理论篇)
- linux----------centos下添加环境变量
- POJ 3311 Hie with the Pie 【状压DP】
- 获取数值型数组的平均值(分别使用增强for循环和普通for循环)
- emacs简易配置
- vue-cli 打包后显示favicon.ico小图标
- hibernate 解决并发问题
- 两个有序数组求中位数log(m+n)复杂度
热门文章
- [Python] The get() method on Python dicts and its ";default"; arg
- 几个经常使用的cmd命令
- FarPoint.Win.Spread 常规操作
- 中英文对照 —— 标点符号(punctuation)
- Oracle中暂时表空间的清理
- php课程 10-35 php实现文件上传的注意事项是什么
- php杂项函数
- AE要素选择(点选和拉框选择)
- Eclipse RCP 中创建自己定义首选项,并能读取首选项中的值
- POJ 2185 Milking Grid KMP循环节周期