import React , { Suspense , lazy } from 'react' ; import { BrowserRouter , Route , Switch } from 'react-router-dom' ; const Home = lazy ( ( ) => import ( '../pages/Home' ) ) ; const NotFound = lazy ( ( ) => import ( '../pages/NotFound' ) ) ; const Routes = ( ) => { return ( < BrowserRouter > < Suspense fallback = { < span > Loading ... < /span>}> < Switch > < Route exact path = "/" component = { Home } / > < Route path = "*" component = { NotFound } / > < /Switch> < /Suspense> < /BrowserRouter>); } ; export default Routes ;