Marcisbee / radi-router

The official router for Radi.js.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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 discord

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

About

The official router for Radi.js.

License:MIT License


Languages

Language:JavaScript 100.0%