在actions中,定義了一個方法去調用接口,然后在頁面中調用actions中定義的方法,當actions方法成功請求接口后,如何自動跳轉到指定的path,在actions中寫過this.props.history.push(""),然后報history undefined,然后試過很多寫法,都不能達到效果,請大家幫幫忙,出出主意,非常感謝
1 回答

ibeautiful
TA貢獻1993條經驗 獲得超6個贊
先引入import { Link, withRouter } from "react-router-dom";
再包裝const Component = withRouter(createForm()(_Component));
這樣history就不會報undefined了
添加回答
舉報
0/150
提交
取消