lazyload-inferno-component
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

lazyload-inferno-component

inferno component to lazily load other components

Usage

npm install --save lazyload-inferno-component

With inferno-router and webpack:

import LazyLoader from "lazyload-inferno-component";
 
const loadComponent = (callback, { props, router }) => {
  require.ensure([], (require) => {
    const component = require("./lazyLoaded").default;
    callback(component);
  });
};
 
export const router = (
  <Router history={createBrowserHistory()}>
    <Route component={App}>
      <IndexRoute component={Home} />
      <Route path="/lazy" lazyLoad={loadComponent} component={LazyLoader} />
    </Route>
  </Router>
);

Inside another component:

export const MyComponent = () => {
  return (
    <div>
      <LazyLoader lazyLoad={loadComponent} />
    </div>
  );
};

Github repository available at https://github.com/LGabAnnell/lazyload-inferno-component

Package Sidebar

Install

npm i lazyload-inferno-component

Weekly Downloads

1

Version

1.0.5

License

MIT

Last publish

Collaborators

  • lgabannell