mirror of
https://github.com/PlayEdu/frontend.git
synced 2025-12-26 16:19:47 +08:00
路由懒加载 + loading
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
import { useRoutes } from "react-router-dom";
|
||||
import routes from "./routes";
|
||||
import "./App.scss";
|
||||
import { Suspense } from "react";
|
||||
import LoadingPage from "./pages/loading";
|
||||
|
||||
function App() {
|
||||
const Views = () => useRoutes(routes);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Suspense fallback={<LoadingPage />}>
|
||||
<Views />
|
||||
</div>
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user