npm.io
0.1.7 • Published 9 years ago

creasync

Licence
MIT
Version
0.1.7
Deps
6
Vulns
0
Weekly
0

Creasync Build Status Dependency Status

Asynchronous route and component for react.

Using webpack chunking, the imported component's chunk will be automatically be created. With this, We can also implement the lazy loading component and error component.

Methods

The creasync method accepts an object.

component - component path.

error - error component to be rendered.

loading - loading component to be rendered.

Sample

import creasync from 'creasync'

const NewComponent = creasync({
    component: System.import('url-to-component'),
    error: () => (<div>Something went wrong...</div>),
    loading: () => (<div>loading component...</div>)
})
Examples

See the examples directory.

run the server

npm run examples:serve

then run webpack

npm run examples:webpack
Disclaimer

Work in progress