import React, { Component,lazy,Suspense} from 'react';
import LayoutComponent from './components/layout/Layout'
import BurgerBuilderContainer from './Containers/BurgerBuilder/BurgerBuilder'
import CheckoutContainer from './Containers/CheckOut/Checkout'
import { Route, Switch,withRouter } from 'react-router-dom'
const OrdersContainer = lazy(()=> {
return import('./Containers/Orders/Orders')
})
render(){
return (
<div>
<Suspense fallback={<div>Loading...</div>}>
<LayoutComponent>
<Switch>
<Route path="/Logout" component={LogoutContainer}></Route>
<Route path="/Auth" component={AuthContainer}></Route>
<Route path="/Orders" component={OrdersContainer}></Route>
<Route path="/checkout" component={CheckoutContainer}></Route>
<Route path="/" component={BurgerBuilderContainer}></Route>
</Switch>
</LayoutComponent>
</Suspense>
</div>
);
}
AsPer 错误延迟加载在导入时显示错误,在使用延迟加载应用程序工作正常之前。