在react中,如果遇到redux的connect 和 一般组件跳转的withRouter 同时使用
...
import React from 'react';
import {connect} from 'react-redux'
import { withRouter } from "react-router-dom";
class MyHeader extends Component {
}
const mapStateToProps=(state)=>{
return {
}
};
const mapDispatchToProps = (dispatch) => {
return {
};
};
//连环嵌套
export default connect(mapStateToProps, mapDispatchToProps)(withRouter(MyHeader));
image.gif
网友评论