我有一个注册表单,用户注册后,它将重定向到用户输入通过电子邮件发送的确认码的电子邮件确认页面(/确认)。当用户提交确认码时,我想将代码和用户的电子邮件发送到服务器端。如何在React中重定向到其他路线时传递状态/道具?
我的申请表单的代码(简化):
constructor(props){
super(props);
this.state = {
email: '',
password: '',
errors: {},
}
}
handleSubmit(e){
e.preventDefault();
this.props.userSignup(this.state).then(
() => {
this.context.router.push({
pathname: '/confirmation'
})
},
)
}
render(){ ...
我不想任何PARAMS添加到我的路径。
如何将this.state.email
传递给确认页?
使用反应路由器https://github.com/ReactTraining/react-router –