Search code examples
javascriptjsonreduxredux-devtools

Getting entire redux state as a separate JSON file


I need to get the whole Redux state as a JSON file without payload or action from Redux DevTools, just the state.


Solution

  • If you're using React, and have React DevTools installed, there's another way to get the state from within Chrome:

    Open React DevTools Components tab and select the top level "Provider": React DevTools Components Tab

    Then go to the Console tab and paste this into the prompt: JSON.stringify($r.store.getState()) $r.store.getState()

    $r is the currently selected component in react devtools