MateAdmin supportsAsyncComponent
. All the components are being used in this app are based onReact Router 4
. asyncComponent
provide you the facility toAsynchronously
load components and feed them intoMatch on route changes
.
you will find theasyncComponent
related function and necessary code from the below file
To find out the code of
asyncComponent
related router, please go to your-apps-root-path/src/containers/App/AppRouter.jsTo find out the code of
asyncComponent
related function, please go to your-apps-root-path/src/helpers/AssyncFunc.js
The Basic Route Component for The Widgets,
<Route
exact
path="/"
component={asyncComponent(() => import('./containers/Page/signin'))}
/>
TheasyncComponent
function
export default function(loader, Loader = LoaderPlaceholder) {
const Loading = props => {
if (props.isLoading) {
if (props.timedOut) {
return <div>Loader timed out!</div>;
} else if (props.pastDelay) {
return <Loader />;
} else {
return null;
}
} else if (props.error) {
return <div>Error! Component failed to load</div>;
} else {
return null;
}
};
return Loadable({
loader,
loading: Loading,
});
}
AsyncComponent
MateAdmin supportsAsyncComponent
. All the components are being used in this app are based onReact Router 4
. asyncComponent
provide you the facility toAsynchronously
load components and feed them intoMatch on route changes
.
you will find theasyncComponent
related function and necessary code from the below file
To find out the code of
asyncComponent
related router, please go to your-apps-root-path/src/containers/App/AppRouter.jsTo find out the code of
asyncComponent
related function, please go to your-apps-root-path/src/helpers/AssyncFunc.js
The Basic Route Component for The Widgets,
<Route
exact
path="/"
component={asyncComponent(() => import('./containers/Page/signin'))}
/>
TheasyncComponent
function
export default function(loader, Loader = LoaderPlaceholder) {
const Loading = props => {
if (props.isLoading) {
if (props.timedOut) {
return <div>Loader timed out!</div>;
} else if (props.pastDelay) {
return <Loader />;
} else {
return null;
}
} else if (props.error) {
return <div>Error! Component failed to load</div>;
} else {
return null;
}
};
return Loadable({
loader,
loading: Loading,
});
}