React redux connect with with styles and withrouter
I am trying to use connect in redux react as Connect (mapstate.., mapdis..) (withstyles(dashboardstyle)(dashboard) The above works fine but I need to add withRouter as well. Below change gives error Connect (mapstate.., mapdis..) (withstyles(dashboardstyle), withrouter(dashboard)) Whenever I add it gives exception such as cannot use class as a function. Any ideas how this can be fixed You will need to install recompose: npm i -s recompose Then in your component: import compose from 'recompose/compose' export default compose( withStyles(styles), connect(mapStateToProps, mapDispatchToProps) )