Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mjanssen/preact-route-async
Easy asynchronous loading for your router components. For 440B.
https://github.com/mjanssen/preact-route-async
microbundle preact preact-components preact-router
Last synced: 3 months ago
JSON representation
Easy asynchronous loading for your router components. For 440B.
- Host: GitHub
- URL: https://github.com/mjanssen/preact-route-async
- Owner: mjanssen
- License: mit
- Created: 2018-08-24T12:10:24.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-08-28T20:59:59.000Z (over 6 years ago)
- Last Synced: 2024-10-12T02:55:56.145Z (3 months ago)
- Topics: microbundle, preact, preact-components, preact-router
- Language: JavaScript
- Homepage:
- Size: 29.3 KB
- Stars: 35
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-preact - Preact Route Async - A (440b gzip) route component that enables async loading of page-components. (Uncategorized / Uncategorized)
README
# Preact route async
[![npm](https://img.shields.io/npm/v/preact-route-async.svg)](http://npm.im/preact-route-async)
[![gzip size](http://img.badgesize.io/https://unpkg.com/preact-route-async/dist/preact-route-async.js?compression=gzip)](https://unpkg.com/preact-route-async/dist/preact-route-async.js)**Asynchronous** loading for Preact Router. For _440B_.
Inspired by [preact-async-route](https://github.com/prateekbh/preact-async-route). Bundled with [📦 Microbundle](https://github.com/developit/microbundle)
# Install
```
npm install --save preact-route-async
```# Usage
```
import Router from 'preact-router';
import Route from 'preact-route-async';
import('./pages/user.js')}
/>```
# Options
Props and children wil automatically be passed to the fetched Component.
The library also passes the `path` property, coming from `preact-router` to the Component.# Demo
Code demo [can be found here](https://codesandbox.io/s/k20z33l3w7)
# License
[MIT](https://oss.ninja/mit/mjanssen/)