when using the react-loadable library for code segmentation and demand loading, according to the code written on the official website demo, the page is always in the loading component state, and refreshing the page does not work
const Loading = () = > {
return < div className="loading" > < Icon type="loading" size="lg"/ > < / div >
}
const Strategy = Loadable ({
loader: () = > import (". / modules/strategy/strategy.jsx"),
loading: Loading
});
const OtherBuy = Loadable ({
loader: () = > import (". / modules/otherBuy/otherBuy.jsx"),
loading: Loading
});
look forward to displaying the lodaing component before the js file is loaded, and display the page content after loading, the actual page has been in the lodaing state; proceed completely according to the official website, can not find the problem, ask for help!
router partial code
<HashRouter>
<Switch>
<Route path="/index" component={Main}/>
<Route path="/strategy" component={Strategy}/>
<Route path="/otherBuy" component={OtherBuy}/>
<Route path="/" render={ () => {return <Redirect to="/index"/>} }/>
</Switch>
</HashRouter>