我有一个注册表单,用户注册后,它将重定向到电子邮件确认页面(/确认),用户在其中输入我通过电子邮件发送的确认码。当用户提交确认码时,我想将代码和用户的电子邮件发送到服务器端。
我的注册表单代码(简化):
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(){ ...
我不想向我的路径添加任何参数。
我怎样才能通过this.state.email
到确认页面?
我想到了。
this.context.router.push({
pathname: '/confirmation',
state: {email: this.state.email}
})
并通过以下方式访问状态:
this.props.location.state.email
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)