add timeout to loading page
This commit is contained in:
parent
50be2dbc1d
commit
82dfd7188f
1 changed files with 11 additions and 6 deletions
|
@ -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>,
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue