While debugging, can I have access to the Redux store from the browser console?

前端 未结 9 1247
难免孤独
难免孤独 2020-12-12 14:01

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

9条回答
  •  忘掉有多难
    2020-12-12 14:48

    let store = createStore(yourApp); window.store = store;

    Now you can access the store from window.store in the console like this:

    window.store.dispatch({type:"MY_ACTION"})

提交回复
热议问题