Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我一直在使用 redux-persist 一段时间的每个人,这确实是一个很棒的工具,但问题是它只会保留我所有的状态(减速器),我想知道是否有一种方法可以选择哪些状态是坚持。谢谢
在您的 redux-persist 配置中,您可以根据需要添加whitelist或。blacklist这些采用您想要包括(白名单)或忽略(黑名单)的状态数组。
whitelist
blacklist
例如:
const persistConfig = { key: 'root', blacklist: ['state-not-to-be-persisted'] }
官方文档