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 状态作为 JSON 文件获取,而不需要来自 Redux DevTools 的有效负载或操作,只是状态。
状态 -> 原始 -> 复制和粘贴
如果你使用 React,并且安装了 React DevTools,还有另一种方法可以从 Chrome 中获取状态:
打开 React DevTools Components 选项卡并选择顶级“Provider”:
然后转到控制台选项卡并将其粘贴到提示中:JSON.stringify($r.store.getState())
JSON.stringify($r.store.getState())
$r 是 react devtools 中当前选中的组件