- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个应用程序,我正在使用 redux 来管理状态,我想将仅 1 个变量的状态清除为初始状态。
I need to make the new albums state to initial state only that not others , if anyone know please let me know
export default {
loading: true,
error: null,
albums: [],
page: 1,
lastId: '',
totalRecord: 0,
album: {
loading: true,
error: null,
message: null,
album: null,
},
newAlbum: {
album_id: null,
images: [],
totalImages: 0,
currently_uploading: 0,
}
};
最佳答案
只需将此案例添加到您的 reducer 中即可:
case 'CLEAR_NEW_ALBUM':
return { ...state, newAlbum: INITIAL_STATE.newAlbum }
关于javascript - 终极版 : reset 1 variable to initial state in Redux,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52256327/
意识到这可能是主观的,具体取决于手头的项目,我正在寻找构建 VS (Visual Studio) 解决方案的“最佳实践”方法。 请随意编辑此内容、评论您认为可能不正确的内容、提出替代方案等。我很高兴看
这个问题不太可能帮助任何 future 的访问者;它只与一个小的地理区域、一个特定的时间点或一个非常狭窄的情况相关,这些情况并不普遍适用于互联网的全局受众。为了帮助使这个问题更广泛地适用,visi
我维护和协作一些用 CommonJS 编写的 JavaScript 模块,这些模块需要高质量的 UMD 包装器。 依赖项来自 npm 但至少有 CommonJS 和 AMD 支持(或者我可以添加它)。
Intellisense 在我的 VS 上运行得非常糟糕...... 当我用 C++ 编写代码时,它可以 100% 正常工作,直到我开始使用模板,然后它才会完全停止工作,停止检测错误并且不会在所有情况
Microsoft网站具有冲突的信息: http://msdn.microsoft.com/en-us/library/ms182372.aspx ...使用Visual Studio Premium
我是一名优秀的程序员,十分优秀!