App.jsApp.jsimportReact, { Component } from‘react’ import { Link, Route, Switch } from‘react-router-dom’ importAuthRouteGuardfrom‘./guard’ importloadComponentfrom‘@loadable/component’ constHome = loadComponent(() =>import(‘./components/home’)) constList = loadComponent(() =>import(‘./components/list’)) constNotFound = loadComponent(() =>import(‘./components/notFound’)) constDetail = loadComponent(() =>import(‘./components/detail’)) /** @loadable/component 需要安装 / classAppextendsComponent { render() { return ( <div> <div> <Linkto=“/home”>首页</Link>—- <Linkto=“/list”>列表页</Link> </div> <div> <Switch> <Routepath=“/“component={Home}exact/> <Routepath=“/home”component={Home}/> <AuthRouteGuardpath=“/list”component={List}/> <Routepath=“/detail/:id”component={Detail}/> <Routecomponent={NotFound}/> </Switch> </div> </div> ) } } exportdefaultApp