|
@ -1,16 +1,35 @@ |
|
|
import React from "react" |
|
|
import React from "react" |
|
|
import { Route, Routes } from "react-router-dom" |
|
|
import { Route, Routes } from "react-router-dom" |
|
|
|
|
|
|
|
|
import NoPageFound from "./pages/NoPageFound" |
|
|
|
|
|
import TestPage from "./pages/TestPage"; |
|
|
|
|
|
|
|
|
const NoPageFound = React.lazy(() => import("./pages/NoPageFound")); |
|
|
|
|
|
const TestPage = React.lazy(() => import("./pages/TestPage")) |
|
|
|
|
|
|
|
|
function App() { |
|
|
function App() { |
|
|
|
|
|
|
|
|
|
|
|
// TODO FIX...
|
|
|
|
|
|
/* |
|
|
|
|
|
There is an weird interaction/error with the lazy loading of the routers |
|
|
|
|
|
and the translation or any other component, that needs to be loaded in |
|
|
|
|
|
lazily... For now this works, but still, this is very hacky and I hate this... |
|
|
|
|
|
*/ |
|
|
|
|
|
var wait = (ms) => { |
|
|
|
|
|
const start = Date.now(); |
|
|
|
|
|
let now = start; |
|
|
|
|
|
while (now - start < ms) { |
|
|
|
|
|
now = Date.now(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
wait(500); |
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|
|
|
|
<React.Suspense fallback="loading"> |
|
|
<Routes> |
|
|
<Routes> |
|
|
<Route path="/" element={<TestPage />} /> |
|
|
|
|
|
<Route path="/info" element={<TestPage />} /> |
|
|
|
|
|
<Route path="*" element={<NoPageFound />} /> |
|
|
|
|
|
|
|
|
<Route path="/" element={<React.Suspense fallback={<>...</>}><TestPage /></React.Suspense>} /> |
|
|
|
|
|
<Route path="/info" element={<React.Suspense fallback={<>...</>}><TestPage /></React.Suspense>} /> |
|
|
|
|
|
<Route path="*" element={<React.Suspense fallback={<>...</>}><NoPageFound /></React.Suspense>} /> |
|
|
</Routes> |
|
|
</Routes> |
|
|
|
|
|
</React.Suspense> |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|