我遇到了Axios方面的问题,不知道在注册或登录后如何进行重定向。
以下是我的代码:
axios.post("/api/user/signup", { data })
.then(res => {
if (res.status === 200) {
console.log("REDIRECTION avec status => ", res.status);
// how to redirect here
<Redirect to = {{ pathname: "/home" }} />
}
代码执行到console.log
语句,但我不知道如何在React中进行重定向。