项目作者: mjanssen

项目描述 :
Easy asynchronous loading for your router components. For 440B.
高级语言: JavaScript
项目地址: git://github.com/mjanssen/preact-route-async.git
创建时间: 2018-08-24T12:10:24Z
项目社区:https://github.com/mjanssen/preact-route-async

开源协议:MIT License

下载


Preact route async

npm
gzip size

Asynchronous loading for Preact Router. For 440B.

Inspired by preact-async-route. Bundled with 📦 Microbundle

Install

  1. npm install --save preact-route-async

Usage

  1. import Router from 'preact-router';
  2. import Route from 'preact-route-async';
  3. <Router>
  4. <Route path="/" component={Home} ></Route>
  5. <Route
  6. path="/user"
  7. user={user}
  8. getComponent={() => import('./pages/user.js')}
  9. />
  10. </Router>

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

License

MIT