0.2.2 • Published 9 years ago

lazy-component-loader v0.2.2

Weekly downloads
5
License
-
Repository
-
Last release
9 years ago

Usage

Documentation: Using loaders

// When you require a component, you get a thin wrapper.
// The real component, and all its module dependencies, are not loaded yet.
var BigComponent = require(lazy-component!./BigComponent);

function renderPage() {
    // When the wrapper is mounted, the real component is loaded asynchronously.
    // All props and children are passed through to the real component.
    React.render(<BigComponent title="Wow!" />, document.body.firstChild);
}

You can pass a placeholder element to be rendered while the real component is still loading:

    const spinner = <div className="spinner">Loading...</div>;
    React.render(
        <BigComponent placeholder={spinner} title="Wow!" />,
        document.body.firstChild
    );

License

MIT (http://www.opensource.org/licenses/mit-license.php)

0.2.2

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago