The page using the react-loadable library is in the lodaing state all the time. What's going on?

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!

clipboard.png

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>

Jun.03,2021
The reason why

did not report an error should be that you handled the error in the Loading component and changed the code in the Loading component to if (error) {return null;. } you can see that the error reported in the console may be Uncaught TypeError: (intermediate value) (intermediate value). Push is not a function and can be displayed normally when the page is refreshed and returned to normal after refreshing and then jumping back through the button.


I have the same problem, and it happens only occasionally on a page. It is not clear why for the time being. If you know anything, please tell


I also encountered this problem and removed it directly.


encounter + 1 and find the positive solution

Menu