fre-routes

0.0.0 • Public • Published

fre-router

simple router for fre

fre-router

Installation

$ npm install fre-router

Example

import { h, render } from 'fre'
import { useRoutes, push } from 'fre-router';
 
const routes = {
  '/': () => (
    <div>
      <p>home</p>
      <button onClick={() => push('/home/jack')}>Go jack</button>
    </div>
  ),
  '/home/:id': ({ id }) => (
    <div>
      <p>{id}</p>
      <button onClick={() => push('/')}>Go home</button>
    </div>
  ),
}
 
const App = () => useRoutes(routes)
 
render(<App />, document.getElementById('root'))

Contributing

  • Fork this Repo first
  • Clone your Repo
  • Install dependencies by $ npm install
  • Checkout a feature branch
  • Feel free to add your features
  • Make sure your features are fully tested
  • Publish your local branch, Open a pull request
  • Enjoy hacking <3

MIT

This work is licensed under the MIT license.


/fre-routes/

    Package Sidebar

    Install

    npm i fre-routes

    Weekly Downloads

    1

    Version

    0.0.0

    License

    MIT

    Unpacked Size

    4.58 kB

    Total Files

    4

    Last publish

    Collaborators

    • song940