且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在React中提交后重定向

更新时间:2022-12-07 11:41:28

假设您使用的是react-router v4,则需要使用历史对象进行导航.

By assuming you are using react-router v4, you will want to use history object to navigate.

import { withRouter } from 'react-router';
...

handleSubmit = () => {
  ...
  this.props.history.push('/moneyform');
}

render() {
  return (
    <ReactFragment>
      <div>
      ...
    </ReactFragment>
  )
}


export default withRouter(confirmWithdraw);