Last active
November 8, 2018 07:56
-
-
Save gladchinda/6d72d00e2cb493be005a0db2001352dd to your computer and use it in GitHub Desktop.
This file contains 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, { Suspense } from 'react'; | |
import { Router } from '@reach/router'; | |
import Loading from './Loading'; | |
const Home = React.lazy(() => import('./Home')); | |
const Dashboard = React.lazy(() => import('./Dashboard')); | |
const Overview = React.lazy(() => import('./Overview')); | |
const History = React.lazy(() => import('./History')); | |
const NotFound = React.lazy(() => import('./NotFound')); | |
function App() { | |
return ( | |
<div> | |
<Suspense fallback={<Loading />}> | |
<Router> | |
<Home path="/" /> | |
<Dashboard path="dashboard"> | |
<Overview path="/" /> | |
<History path="/history" /> | |
</Dashboard> | |
<NotFound default /> | |
</Router> | |
</Suspense> | |
</div> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for the article!
You should add the content of one of the Route components(f.x. Dashboard) to this example to show what is happening within that component :)