1import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';
2import React, { Suspense, lazy } from 'react';
3
4const Home = lazy(() => import('./routes/Home'));
5const About = lazy(() => import('./routes/About'));
6
7const App = () => (
8 <Router>
9 <Suspense fallback={<div>Chargement...</div>}>
10 <Switch>
11 <Route exact path="/" component={Home}/>
12 <Route path="/about" component={About}/>
13 </Switch>
14 </Suspense>
15 </Router>
16);