MateAdmin supportsAsyncComponent. All the components are being used in this app are based onReact Router 4. asyncComponentprovide you the facility toAsynchronouslyload components and feed them intoMatch on route changes.

you will find theasyncComponentrelated function and necessary code from the below file

To find out the code ofasyncComponentrelated router, please go to your-apps-root-path/src/containers/App/AppRouter.js

To find out the code ofasyncComponentrelated 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'))}
/>

TheasyncComponentfunction

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. asyncComponentprovide you the facility toAsynchronouslyload components and feed them intoMatch on route changes.

you will find theasyncComponentrelated function and necessary code from the below file

To find out the code ofasyncComponentrelated router, please go to your-apps-root-path/src/containers/App/AppRouter.js

To find out the code ofasyncComponentrelated 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'))}
/>

TheasyncComponentfunction

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,
  });
}

results matching ""

    No results matching ""