[英]Customise the template for Scaffolded Razor Pages (CRUD) in .net core 3.1 / Visual Studio 2019
[英]How can i redirect in react core 3.1 template in visual studio 2019
我在 Visual Studio 2019 中使用 C# Core 3.1 React 模板。問題是重定向在下面的代碼中沒有按預期工作。 我該如何解決這個問題?
return <Redirect to='/login' />
這對我有用。
import { useHistory } from "react-router-dom";
const Login = () => {
let history = useHistory();
//button event
const SubmitLogin = async (e: SyntheticEvent) => {
e.preventDefault();
history.push('/'); //redirect to home page
}
return (
//your HTML return code here
);
};
export default connect()(Login);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.