get-component-async
load component async for react router
Use
install by:
npm i -S get-component-async
For react router
import getComponentAsync from "get-component-async"; <HashRouter> <Route ="/sub" = /></HashRouter>;
./sub
is code is:
{ return <div>sub</div>; }
For big component
import getElementAsync from "get-component-async"; <div> ...others </div>;
Show loading before loaded
import getElementAsync from "get-component-async"; <div> ...others </div>;
Set default loading before loaded
import setDefaultLoading from "get-component-async"; ;