我需要在提交表单后重定向到 premontessori
页面。我该怎么做?
这是我的handleSubmit
函数:
handleSubmit(event) {
event.preventDefault();
<Link to='/premontessori' style={{textDecoration:'none'}} > alert("New Student Created");</Link>
var data= {
Fname:this.state.Fname,
age:this.state.age,
Lname:this.state.Lname,
dob:this.state.dob,
pob:this.state.pob,
month:this.state.month,
nation:this.state.nation,
mothertongue:this.state.mothertongue,
bloodgroup:this.state.bloodgroup
};
axios.post('/create',data)
.then(function(response){
console.log(response);
})
}
最佳答案
您可以使用 react 路由器(例如-hashHistory)进行导航。
hashHistory.goBack();
关于javascript - 提交后需要重定向到上一页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42270459/