An open API service indexing awesome lists of open source software.

https://github.com/therealedsheenan/creasync

Asynchronous routes and components for react
https://github.com/therealedsheenan/creasync

asynchronous-component asynchronous-routes react webpack

Last synced: 3 months ago
JSON representation

Asynchronous routes and components for react

Awesome Lists containing this project

README

        

# Creasync [![Build Status](https://travis-ci.org/therealedsheenan/creasync.svg?branch=master)](https://travis-ci.org/therealedsheenan/creasync) [![Dependency Status](https://dependencyci.com/github/therealedsheenan/creasync/badge)](https://dependencyci.com/github/therealedsheenan/creasync)
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: () => (

Something went wrong...
),
loading: () => (
loading component...
)
})
```

### Examples
See the examples directory.

run the server
```
npm run examples:serve
```
then run webpack

```
npm run examples:webpack
```

#### Disclaimer
Work in progress