npm.io
0.0.4 • Published 10 years ago

redux-devtools-prompt-state

Licence
ISC
Version
0.0.4
Deps
0
Vulns
0
Weekly
0
Stars
1

redux-devtools-prompt-state

This is a small module to debug redux app. After the setup, just press shift+s by default to see a prompt of your current state. You can save it for later use, or replace it with another one.

Setup

npm i --save-dev redux-devtools-prompt-state

Be careful to only put this in dev - use a flag in your build! (or be aware in prod)

Create your store with the replaceState enhancers

import { createStore, compose } from 'redux'
import rootReducer from '../reducers'
import { replaceState, replacer } from 'redux-devtools-prompt-state';

function configureStore(initialState)
{
  const createWithReplaceState = compose(replaceState())(createStore); // replaceState can take an array of key sequence
  const store = createWithReplaceState(rootReducer, initialState);
  replacer(store, [ 'shift+k' ]); // replacer for dom - could be extended in the future

  return store
}
replaceState

replacer(store, keys) takes an array of key sequences as second argument as defined here

Keywords