我在www.infinity2o.com上有一个react / redux webapp,有多个路由:
<Route exact={true} path="/profile" component={Profile} />
<Route exact={true} path="/sorting_hat" component={SortingHat} />
我遇到的问题是我的UI颜色主题被保存到我的redux商店中 . 但是每当我的URL路由从 infinity2o.com/profile
变为 infinity2o.com/sorting_hat
时,我的整个状态都会重置为 null
.
在路由之间切换时,是否可以保持我的一些redux状态持久?
1 回答
你可以尝试使用redux-persist库