inferno-route
TypeScript icon, indicating that this package has built-in type declarations

1.1.20 • Public • Published

inferno-route

Another routing library for Inferno.

  • Incredibly lightweight (with only 1 component Route)
  • TypeScript friendly

Installation

npm install --save inferno-route

Usage

import Component from "inferno-component"
import Route from "inferno-route"

class User extends Component<any, {}> {
    render() {
        return this.props.params.id
    }
}

// Set your entry point, like "#/", "#/1/2", "#/users/wizawu"
if (!window.location.hash) window.history.replaceState(null, null, "#/")

Inferno.render((
    <Route path="#" component={Root}>
        <Route path="1" component={First}>
            <Route path="2" component={Second}>
                <Route path="3" component={Third} />
            </Route>
        </Route>
        <Route path="users/:id" component={User} />
        <Route path="profile/.*" component={Profile} />
    </Route>
), document.body.firstChild)

Issues

Please email to wizawu@gmail.com. Open source soon.

Readme

Keywords

none

Package Sidebar

Install

npm i inferno-route

Weekly Downloads

1

Version

1.1.20

License

none

Last publish

Collaborators

  • wizawu