I have written a container component using redux and my implementation for mapDispatchToProps
looks like this
const mapDispatchToProps = (dispatch, o
You can just use redux-thunk to get state. Write a helper function like this:
const getState = (dispatch) => new Promise((resolve) => {
dispatch((dispatch, getState) => {resolve(getState())})
})
You can use this in a async function or generator function:
const mapDispatchToProps = (dispatch, ownProps) => {
return {
async someFunction() {
const state = await getState(dispatch)
...
}
}
}