路由懒加载

This commit is contained in:
none 2023-03-21 13:38:52 +08:00
parent 3cd9b2b816
commit a0a6744404
2 changed files with 9 additions and 2 deletions

View File

@ -1,11 +1,13 @@
import { Button } from "antd";
import { useDispatch, useSelector } from "react-redux";
import { loginAction, logoutAction } from "../../store/user/loginUserSlice";
export const LoginPage = () => {
const LoginPage = () => {
const dispatch = useDispatch();
const loginState = useSelector((state: any) => {
return state.loginUser.value;
});
return (
<>
<Button
@ -34,3 +36,5 @@ export const LoginPage = () => {
</>
);
};
export default LoginPage;

View File

@ -1,6 +1,9 @@
import { lazy } from "react";
import { RouteObject } from "react-router-dom";
import { LoginPage, LayoutPage } from "../pages";
import { LayoutPage } from "../pages";
const LoginPage = lazy(() => import('../pages/login'))
const routes: RouteObject[] = [
{