Created
August 21, 2021 19:14
-
-
Save charisTheo/8978feead100432402a02f0e0f371a54 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react' | |
| import { | |
| BrowserRouter as Router, | |
| Switch | |
| } from 'react-router-dom' | |
| const HomePage = React.lazy(() => import('./Pages/Home')) | |
| const LoginPage = React.lazy(() => import('./Pages/Login')) | |
| export default function () { | |
| return ( | |
| <Router> | |
| <Switch> | |
| <Route exact path='/'> | |
| <React.Suspense fallback={<p>Loading...</p>}> | |
| <HomePage /> | |
| </React.Suspense> | |
| </Route> | |
| <Route exact path='/login'> | |
| <React.Suspense fallback={<p>Loading...</p>}> | |
| <LoginPage /> | |
| </React.Suspense> | |
| </Route> | |
| </Switch> | |
| </Router> | |
| ) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment