我使用过React lazy进行代码拆分。没有显示错误,但是没有显示该页面。以下代码位于index.js中 我在做什么错了?
import React from "react";
import "./index.css";
import * as serviceWorker from "./serviceWorker";
import { BrowserRouter as Router, Switch, Route } from "react-router-dom";
import {Suspence,lazy} from 'react';
// Imported Pages
const HomePage = lazy(() => import("./components/home_page/index"));
const MoviePage = lazy(() => import("./components/movie_page/index"));
const App = () =>(
<Router>
<Suspence falback ={<div>Loading...</div>}>
<Switch>
<Route exact path="/" component={HomePage} />
<Route exact path="/movie_page" component={MoviePage}/>
</Switch>
</Suspence>
</Router>,
document.getElementById("root")
);
serviceWorker.unregister();
export default App