的使用redux-persist
取决于应用程序的用例。
首先,让我强调一些主要特点redux-persist
PersistGate的使用会自动提供延迟,rendering of the components
直到状态persisted
与显示loading
组件的使用一致。
自定义函数基于多种类型持续存在,例如 persistStore
,persistReducer
和persistObject
AutoMerging
来自initialStates
不同状态的基于shallow
和deep
级别的
可能是最重要的特征blacklisting
和whitelisting
reducers
shallow
级别persistence
和deep
级别的嵌套持久性persistence
坚持migrations
存储不同版本的redux-store
.
转换以支持不可变、压缩、加密、过滤等。
考虑到application
您构建的只是出于development
目的,那么它最多需要PersistGate
,persistStore
并且可能需要减速器blacklist
,考虑到您知道您的应用程序可能需要什么whitelist
,这仍然是相当多的工作 。
现在对于production
水平且易于扩展的应用程序,它至少需要5 / 7
我上面列出的功能。如果没有这个模块,您可能需要安装用于压缩、加密等的模块,找到一种方法来优雅地存储不同版本的redux-store
和retrieve
以及display
可能符合您要求的内容,以及rehydration
该redux-store
状态的。
这还有很多含义,稍后会遇到。因此,根据项目的要求,我认为使用这个包是有益的,管理redux-store storage