[尝试将State保存到localStorage时,存储中出现'不是函数'错误

问题描述 投票:0回答:1

我正在使用本教程https://medium.com/@jrcreencia/persisting-redux-state-to-local-storage-f81eb0b90e7e因为我需要将按钮的状态保存到本地存储中。我按照步骤1:1进行操作,但最终我遇到了这个问题:re

redux react-redux store
1个回答
0
投票

也许第一次运行应用程序时,persistedState为null。尝试使用persistedState

更改persistedState || {}
© www.soinside.com 2019 - 2024. All rights reserved.