前端遇到的坑

Router


对于某个组件,如果同时需要使用connect方法以及withRouter方法,需要将withRouter包裹在connect方法外层,否则withRouter无效.

eg:export default withRouter(connect(mapStateToProps, mapDispatchToProps(Component))