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
- Host: GitHub
- URL: https://github.com/therealedsheenan/creasync
- Owner: therealedsheenan
- License: mit
- Created: 2017-05-23T14:50:45.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2022-11-17T04:49:08.000Z (over 2 years ago)
- Last Synced: 2025-02-25T09:08:08.701Z (4 months ago)
- Topics: asynchronous-component, asynchronous-routes, react, webpack
- Language: JavaScript
- Size: 192 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Creasync [](https://travis-ci.org/therealedsheenan/creasync) [](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