add timeout to loading page

This commit is contained in:
Aleksey_Levin 2024-01-08 15:10:41 +08:00
parent 50be2dbc1d
commit 82dfd7188f

View file

@ -3,12 +3,17 @@ import ReactDOM from 'react-dom/client'
import './index.css'
import Loading from "./app/components/Loading/Loading.tsx";
const App = React.lazy(() => import('./App').then(module => ({ default: module.App })))
const App = React.lazy(() =>
new Promise<typeof import("./App")>(( resolve ) => {
setTimeout(async () => {
resolve(import('./App'))
}, 3000)
}).then(module => ({ default: module.App })))
ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<React.Suspense fallback={<Loading />}>
<App />
</React.Suspense>
</React.StrictMode>,
<React.StrictMode>
<React.Suspense fallback={<Loading />}>
<App />
</React.Suspense>
</React.StrictMode>,
)