mirror of
https://github.com/Grasscutters/Meadow.git
synced 2024-11-23 12:29:41 +00:00
Lazy load routes
This commit is contained in:
parent
b13541fb7b
commit
96f2e9267f
@ -2,10 +2,11 @@ import React from "react";
|
||||
import { Routes, Route } from "react-router-dom";
|
||||
|
||||
import Header from "@components/Header";
|
||||
import Loader from "@components/common/Loader";
|
||||
|
||||
import Home from "@pages/Home";
|
||||
import Downloads from "@pages/Downloads";
|
||||
import ConfigGen from "@pages/ConfigGen";
|
||||
const Downloads = React.lazy(() => import("@pages/Downloads"));
|
||||
const ConfigGen = React.lazy(() => import("@pages/ConfigGen"));
|
||||
|
||||
import "@css/App.css";
|
||||
|
||||
@ -16,10 +17,18 @@ class App extends React.Component {
|
||||
<Header />
|
||||
<Routes>
|
||||
<Route path={"/"} element={<Home />} />
|
||||
<Route path={"/downloads"} element={<Downloads />} />
|
||||
<Route path={"/downloads"} element={
|
||||
<React.Suspense fallback={<Loader />}>
|
||||
<Downloads />
|
||||
</React.Suspense>
|
||||
} />
|
||||
<Route path={"/wiki"} element={<p>Wiki</p>} />
|
||||
<Route path={"/features"} element={<p>Features</p>} />
|
||||
<Route path={"/config"} element={<ConfigGen />} />
|
||||
<Route path={"/config"} element={
|
||||
<React.Suspense fallback={<Loader />}>
|
||||
<ConfigGen />
|
||||
</React.Suspense>
|
||||
} />
|
||||
</Routes>
|
||||
|
||||
<div className={"Footer"}>
|
||||
|
Loading…
Reference in New Issue
Block a user