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 has been modified accordingly.
I'm looking for something like:
window._redux.store
... in the browser so I can type that on the console and check how things are going.
How can I achieve that?
The react devtools have changed since my original answer. The new components
tab in chrome's devtools still has the data, but you may have to search a little bit more.
Components
tabstore
to be shownstore
(for me it was the 4th level)$r.props.store.getState()
If you have react developer tools running you can use $r.store.getState();
with no changes to your codebase.
Note: You have to open the react devtool in your developer tools window first to make this work, otherwise you will get a $r is not defined
error
$r.store.getState();
or $r.store.dispatch({type:"MY_ACTION"})
into your console