Quan Vuong
Quan Vuong

Reputation: 1989

Save state of redux store during development

How can I hydrate my redux store with a JSON file (that was previously export from Redux dev tools) for development purposes (to avoid call to database) ?

Upvotes: 1

Views: 499

Answers (1)

Amberlamps
Amberlamps

Reputation: 40448

What is the purpose of this? Anyway:

  1. Set a breakpoint at where you hydrate your store (e.g. let store = createStore(todoApp, window.STATE_FROM_SERVER))
  2. Overwrite window.STATE_FROM_SERVER in the console with the JSON that you exported before.
  3. Continue running your script.

Obviously the checksums are going to mismatch if you are using server-side rendering.

Upvotes: 1

Related Questions