0.0.11 • Published 6 years ago

@mise/router v0.0.11

Weekly downloads
1
License
MIT
Repository
-
Last release
6 years ago

Mise Routing

Declarative routing for Mise

Installation

npm i --save @mise/router

In your actual project

import { dom, component } from '@mise/core';
import { Route, Link } from '@mise/router';

You can also use the UMD version

<script async src="https://unpkg.com/@mise/core"></script>
<script async src="https://unpkg.com/@mise/router"></script>
<script type="javascript">
  const { dom, component } = mise;
  const { Route, Link } = miseRouter;
</script>

Neither Mise nor the router require compilation to run, but you won't be able to use JSX until you do.

Examples

import { dom, component } from '@mise/core';
import { Route, Switch } from '@mise/router';

import { template as HomeTemplate } from './components/home/home.template';
import { template as LoginTemplate } from './component/login/login.template';
import { template as RegisterTemplate } from './component/register/register.template';

import { template as TracksTemplate } from './components/tracks/tracks.template';
import { template as TrackTemplate } from './component/track/track.template';

import { state } from './state.js';
import { actions } from './actions.js';

component({
    template: state => actions => (
        <Switch>
            <Route path="/" template={HomeTemplate} />
            <Route path="/login" template={LoginTemplate} />
            <Route path="/register" template={RegisterTemplate} />
            
            <Route path="/tracks" template={TracksTemplate} />
            <Route path="/tracks/:id" template={TrackTemplate} />
        </Switch>
    ),
    state,
    actions,
    root: document.querySelector('#app');
})

More details can be found in the docs.

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago