You can also use the:
import { withRouter } from 'react-router-dom';
And then on your export default, you do like this:
export default withRouter(connect(mapStateToProps, {})(Layout));
Because when you have an export connect, you need to tell that that component will be using the router.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…