I have unit tests for my reducers
. However, when I\'m debugging in the browser, I want to check if my actions have been called correctly and whether the state h
Another answer suggests adding the store to the window, but if you just want access to the store as an object, you can define a getter on the window.
This code needs to be added where you've configured your store - in my app, this is the same file as where
is called.
Now you can type reduxStore
in the console to get an object - and copy(reduxStore)
to copy it to the clipboard.
Object.defineProperty(window, 'reduxStore', {
get() {
return store.getState();
},
});
You can wrap this in an if (process.env.NODE_ENV === 'development')
to disable it in production.