Skip to content

Instantly share code, notes, and snippets.

@marshallmurphy
Created August 17, 2020 00:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marshallmurphy/d8f1fa6756d13cafed1ca9c14dfdd3d3 to your computer and use it in GitHub Desktop.
Save marshallmurphy/d8f1fa6756d13cafed1ca9c14dfdd3d3 to your computer and use it in GitHub Desktop.
// App.js
import React, { lazy, Suspense } from 'react';
import { Router } from "@reach/router";
import Main from './Main';
// import SplitThis from './SplitThis';
import './App.css';
// lazy load the component
const SplitThis = lazy(() => import('./SplitThis'));
const App = () => (
<div className="App">
<Suspense fallback={ <h1>Loading route...</h1>}>
<Router>
<Main default path="/" />
<SplitThis path="/split" />
</Router>
</Suspense>
</div>
);
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment