radi-router
is the official router for Radi.js. It deeply integrates with Radi for seamless application building.
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.
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 is currently being written. For now just a few examples to work our appetite.
/** @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);
Copyright (c) 2018-present, Marcis (Marcisbee) Bergmanis