1.0.5 • Published 7 years ago

lazyload-inferno-component v1.0.5

Weekly downloads
-
License
MIT
Repository
-
Last release
7 years ago

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

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago