Javascript 提交后清除url
我在应用程序中使用react、redux和react路由器。当我提交登录名和密码时,我会将axios请求发送到后端,然后在收到响应后更新我的用户。这很好,但我的问题是,在我按Enter键或单击“登录”后,我的url将更改为以下内容:Javascript 提交后清除url,javascript,html,reactjs,url,redux,Javascript,Html,Reactjs,Url,Redux,我在应用程序中使用react、redux和react路由器。当我提交登录名和密码时,我会将axios请求发送到后端,然后在收到响应后更新我的用户。这很好,但我的问题是,在我按Enter键或单击“登录”后,我的url将更改为以下内容: http://localhost:3000/?email=example123%40gmail.com&password=pass123 有没有办法阻止url更改或在提交后清除它 表格: 电子邮件 {this.state.emailErr} 密码 {th
http://localhost:3000/?email=example123%40gmail.com&password=pass123
有没有办法阻止url更改或在提交后清除它
表格:
电子邮件
{this.state.emailErr}
密码
{this.state.pswdErr}
登录
默认情况下,您的表单正在尝试自行提交。
将此添加到您的登录方法:
login(event) {
event.preventDefault();
}
默认情况下,您的表单正在尝试自行提交。 将此添加到您的登录方法:
login(event) {
event.preventDefault();
}
当然,只要等10分钟就行了。当然,只要等10分钟就行了