mirror of
https://github.com/TheGreyDiamond/Enlight.git
synced 2026-03-31 23:00:24 +02:00
init
This commit is contained in:
28
enlightApp/app/Routes.tsx
Normal file
28
enlightApp/app/Routes.tsx
Normal file
@@ -0,0 +1,28 @@
|
||||
/* eslint react/jsx-props-no-spreading: off */
|
||||
import React from 'react';
|
||||
import { Switch, Route } from 'react-router-dom';
|
||||
import routes from './constants/routes.json';
|
||||
import App from './containers/App';
|
||||
import HomePage from './containers/HomePage';
|
||||
|
||||
// Lazily load routes and code split with webpack
|
||||
const LazyCounterPage = React.lazy(() =>
|
||||
import(/* webpackChunkName: "CounterPage" */ './containers/CounterPage')
|
||||
);
|
||||
|
||||
const CounterPage = (props: Record<string, any>) => (
|
||||
<React.Suspense fallback={<h1>Loading...</h1>}>
|
||||
<LazyCounterPage {...props} />
|
||||
</React.Suspense>
|
||||
);
|
||||
|
||||
export default function Routes() {
|
||||
return (
|
||||
<App>
|
||||
<Switch>
|
||||
<Route path={routes.COUNTER} component={CounterPage} />
|
||||
<Route path={routes.HOME} component={HomePage} />
|
||||
</Switch>
|
||||
</App>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user