hyperapp-hoa-router
TypeScript icon, indicating that this package has built-in type declarations

0.2.7 • Public • Published

A Hyperapp Router

Quick Start

import { app } from 'hyperapp'
import { createHashHistory } from 'history'
import { withRouter, routerFactory } from 'hyperapp-hoa-router'
import App from './components/App'

const history = createHashHistory()

const config = {
  factories: [routerFactory(history)]
}

withRouter(app, config)({}, {}, App, document.body)

or

import { app } from 'hyperapp'
import { createHashHistory } from 'history'
import { init, routerFactory } from 'hyperapp-hoa-router'
import App from './App'

init('router')
const router = routerFactory(createHashHistory())
const main = app(
  { router: router.state },
  { router: router.actions },
  App,
  document.body
)
router.sub(main)

Components

Components are basically identify with hyperapp/router components

  • Route

  • Switch

  • Link

  • Redirect

Dependencies Reference

Hyperapp: 1 kB JavaScript framework for building web applications.

History: Easily manage session history anywhere JavaScript runs. Abstracts away the differences in various environments and provides a minimal API that lets you manage the history stack, navigate, confirm navigation, and persist state between sessions.

Readme

Keywords

Package Sidebar

Install

npm i hyperapp-hoa-router

Weekly Downloads

3

Version

0.2.7

License

ISC

Unpacked Size

42.3 kB

Total Files

27

Last publish

Collaborators

  • gulewei