我正在使用 react-router-4 并且此版本的相应 react-router-redux 还不稳定。我很好奇是否有办法history
从redux-observable
史诗中访问。例子:
export function profileDropdownEpic (action$, { getState, dispatch }{
return action$.ofType('SET_SELECTED_ITEM')
.mapTo(() => {
const selectedItem = getState().listDropdown.get('SelectedItem')
if (selectedItem === 'logout') {
history.push('/login')
}
return {}
})
}