redux - 为什么 redux 操作类型应该在 UPPER_CASE 中?

标签 redux

有没有更深层次的原因为什么 redux 中的操作类型应该是所有带下划线的大写字符串?

一个字符串只是一个字符串,对吧?为什么不使用 Action 创建者的名称(通常是驼峰式命名)作为他们创建的 Action 的类型?

最佳答案

capital letters for constants



这只是一个在其他语言中也很常见的约定。

关于 redux 命名约定的有趣文章:
https://decembersoft.com/posts/a-simple-naming-convention-for-action-creators-in-redux-js/

关于redux - 为什么 redux 操作类型应该在 UPPER_CASE 中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43137838/

相关文章:

javascript - Redux 中的 "Reducer"可以默认返回初始状态和默认值吗?

javascript - 为什么 componentDidMount 在高阶组件中调用不止一次?

javascript - 警告 : Failed propType: Invalid prop `swimmingSnapshot` of type `function` supplied to `LaptopHandling` ,

javascript - React - 使用 reduxForm 的两个语句之间的差异

angular - Redux - 如何在大型应用程序中组织商店

javascript - Redux reducer 中的传播运算符

redux - 为什么我的Redux reducer 认为我的状态未定义?

reactjs - 检查 React 中是否未定义

javascript - 添加了一个 props onPress,因为我正在调用事件handleEvent。但方法内没有打印任何内容

javascript - 在 Redux 中存储 React 路由