withRouter, connect() and react-compose
connect
returns a function that takes the component. So, I think it would work if you slightly change your parens:
export default compose(
withRouter,
connect(mapStateToProps)(Dashboard)
);
Or:
export default connect(mapStateToProps)(compose(
withRouter,
Dashboard
));
You can simply use this as mentioned by Parnab Sanya
export default withRouter(connect(mapStateToProps)(HomeComponent))
or If you have withStyles()
then use this
export default withRouter(
compose(
withStyles(HomeComponentStyle),
connect(mapStateToProps)
)(HomeComponent));
export default withRouter(connect(mapStateToProps)(Dashboard))
Works fine and is short.