radi-router

0.4.1 • Public • Published

radi-router

radi-router is the official router for Radi.js. It deeply integrates with Radi for seamless application building.

npm version npm downloads gzip bundle size radi workspace on slack

Installation

To install the stable version:

npm install --save radi-router

This assumes you are using npm as your package manager.

If you're not, you can access these files on unpkg, download them, or point your package manager to them.

Browser Compatibility

radi-router currently is compatible with browsers that support ES6. In stable release v1 it will support ES5 compatible browsers and even some below that, yes - looking at IE8 too.

Documentation

Documentation is currently being written. For now just a few examples to work our appetite.

Foo bar routing example

/** @jsx r **/
import { r, use, mount, component } from 'radi'
import router from 'radi-router'
 
const index = component({
  view: function() { return <h1>Index</h1> }
});
 
const foo = component({
  view: function() { return <h1>Foo</h1> }
});
 
const RouterComponent = use({
  routes: {
    '/': index,
    '/foo': foo
  }
})
 
mount((
  <div>
    <a href="#/">index</a>
    <a href="#/foo">foo</a>
    <div>
      { new RouterComponent() }
    </div>
  </div>
), document.body);

Stay In Touch

License

MIT

Copyright (c) 2018-present, Marcis (Marcisbee) Bergmanis

Dependencies (0)

    Dev Dependencies (6)

    Package Sidebar

    Install

    npm i radi-router

    Weekly Downloads

    3

    Version

    0.4.1

    License

    MIT

    Unpacked Size

    98.9 kB

    Total Files

    11

    Last publish

    Collaborators

    • marcisbee