How to push to History in React Router v4?

后端 未结 21 1848
不思量自难忘°
不思量自难忘° 2020-11-22 00:27

In the current version of React Router (v3) I can accept a server response and use browserHistory.push to go to the appropriate response page. However, this isn

21条回答
  •  伪装坚强ぢ
    2020-11-22 01:18

    you can use it like this as i do it for login and manny different things

    class Login extends Component {
      constructor(props){
        super(props);
        this.login=this.login.bind(this)
      }
    
    
      login(){
    this.props.history.push('/dashboard');
      }
    
    
    render() {
    
        return (
    
       
    )

提交回复
热议问题