remove redundant react-loadable
This commit is contained in:
parent
1ab13261d7
commit
691d0cd9b5
@ -30,7 +30,6 @@
|
|||||||
"react-app-polyfill": "^0.2.1",
|
"react-app-polyfill": "^0.2.1",
|
||||||
"react-chartjs-2": "^2.7.4",
|
"react-chartjs-2": "^2.7.4",
|
||||||
"react-dom": "^16.8.4",
|
"react-dom": "^16.8.4",
|
||||||
"react-loadable": "^5.5.0",
|
|
||||||
"react-router-config": "^4.4.0-beta.6",
|
"react-router-config": "^4.4.0-beta.6",
|
||||||
"react-router-dom": "^4.3.1",
|
"react-router-dom": "^4.3.1",
|
||||||
"react-test-renderer": "^16.8.4",
|
"react-test-renderer": "^16.8.4",
|
||||||
|
45
src/App.js
45
src/App.js
@ -1,50 +1,33 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import { HashRouter, Route, Switch } from 'react-router-dom';
|
import { HashRouter, Route, Switch } from 'react-router-dom';
|
||||||
// import { renderRoutes } from 'react-router-config';
|
// import { renderRoutes } from 'react-router-config';
|
||||||
import Loadable from 'react-loadable';
|
|
||||||
import './App.scss';
|
import './App.scss';
|
||||||
|
|
||||||
const loading = () => <div className="animated fadeIn pt-3 text-center">Loading...</div>;
|
const loading = () => <div className="animated fadeIn pt-3 text-center">Loading...</div>;
|
||||||
|
|
||||||
// Containers
|
// Containers
|
||||||
const DefaultLayout = Loadable({
|
const DefaultLayout = React.lazy(() => import('./containers/DefaultLayout'));
|
||||||
loader: () => import('./containers/DefaultLayout'),
|
|
||||||
loading
|
|
||||||
});
|
|
||||||
|
|
||||||
// Pages
|
// Pages
|
||||||
const Login = Loadable({
|
const Login = React.lazy(() => import('./views/Pages/Login'));
|
||||||
loader: () => import('./views/Pages/Login'),
|
const Register = React.lazy(() => import('./views/Pages/Register'));
|
||||||
loading
|
const Page404 = React.lazy(() => import('./views/Pages/Page404'));
|
||||||
});
|
const Page500 = React.lazy(() => import('./views/Pages/Page500'));
|
||||||
|
|
||||||
const Register = Loadable({
|
|
||||||
loader: () => import('./views/Pages/Register'),
|
|
||||||
loading
|
|
||||||
});
|
|
||||||
|
|
||||||
const Page404 = Loadable({
|
|
||||||
loader: () => import('./views/Pages/Page404'),
|
|
||||||
loading
|
|
||||||
});
|
|
||||||
|
|
||||||
const Page500 = Loadable({
|
|
||||||
loader: () => import('./views/Pages/Page500'),
|
|
||||||
loading
|
|
||||||
});
|
|
||||||
|
|
||||||
class App extends Component {
|
class App extends Component {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<HashRouter>
|
<HashRouter>
|
||||||
<Switch>
|
<React.Suspense fallback={loading()}>
|
||||||
<Route exact path="/login" name="Login Page" component={Login} />
|
<Switch>
|
||||||
<Route exact path="/register" name="Register Page" component={Register} />
|
<Route exact path="/login" name="Login Page" component={Login} />
|
||||||
<Route exact path="/404" name="Page 404" component={Page404} />
|
<Route exact path="/register" name="Register Page" component={Register} />
|
||||||
<Route exact path="/500" name="Page 500" component={Page500} />
|
<Route exact path="/404" name="Page 404" component={Page404} />
|
||||||
<Route path="/" name="Home" component={DefaultLayout} />
|
<Route exact path="/500" name="Page 500" component={Page500} />
|
||||||
</Switch>
|
<Route path="/" name="Home" component={DefaultLayout} />
|
||||||
|
</Switch>
|
||||||
|
</React.Suspense>
|
||||||
</HashRouter>
|
</HashRouter>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user