フォームを送信した後に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);
})
}
ありがとうございます。しかし、問題はそれを提出した後にそれがpremontessoriにリダイレクトされていますが、私が提出したものは、premontessoriページに表示されていません。私は今どうすればいい? –
あなたは、そこからデータをリロードするよりも、還元やフラックスのようないくつかのストアにデータを保存することができます。また、hashHistory.push( '/ premontessori?a = b&c = d')やプリプロセッサリコンポーネントの値はthis.props.location.query.aを使用しています –