I'm a bit clueless as to how to use React Router's history.push('/route') with Redux.
In other words, if you connect a component with Redux's mapDispatchToProps, how do you put history.push('/route') that is supposed to be fired after dispatching a certain action?
To clarify the issue, here is a snippet of my experimentation...
class PostContainer extends React.Component {
    handleSubmit(data) {
        return this.props.addPost(data);
    }
    render() {
        return (<Post onSubmit={data=> this.handleSubmit(data)}/>);
    }
}
const mapDispatchToProps = (dispatch) => {
    return {    
        addPost: (data) => {
            dispatch(addPost(data)).data.then((result) => {
                dispatch(addPostFulfilled(result.data));
                //How do you call the following function?
                this.props.history.push('/posts')
            }).catch((error) => {
                dispatch(addPostRejected());
            });
        },      
    }
}
export default connect(null, mapDispatchToProps)(PostContainer);
As you can see, as soon as a post is added into Redux's state through addPostFulfilled, the page needs to move to /posts via history.push.
According to Redux's doc, containers are made for updating states (as well as fetching data). So, dumb components are not supposed to put anything like history.push.
What would be a better approach than the code above?
Any advice will be appreciated.
 
     
     
     
     
    