-
getState()
retrieves the current state of the Redux store. If we ranconsole.log(store.getState())
with the code above, we could get0
since it is the initial state of our application. -
dispatch()
is the most commonly used. It is how we dispatch actions to change the state of the application. If we runstore.dispatch( { type: 'INCREMENT' });
followed byconsole.log(store.getState());
we will get1
, which reflects the current state resulting from the INCREMENT action. -
subscribe()
registers a callback that the redux store will call any time an action has been dispatched so you can update the UI of your application to reflect the current application state.