fre-router

0.0.0 • Public • Published

fre-router

A router hook for react and fre

Use

import { createRouter, useRouter, push } from 'fre-router'

createRouter([
  {
    path: '/home',
    component: () => <>
      <button onClick={() => push('/home/yse')}>Go yse</button>
    </>,
    children: [
      {
        path: '/:username',
        component: params => <>
          <p>{params.username}</p>
          <button onClick={() => push('/home')}>Go home</button>
        </>
      }
    ]
  }
])

export const App = () => useRoute('/home')

Readme

Keywords

none

Package Sidebar

Install

npm i fre-router

Weekly Downloads

0

Version

0.0.0

License

ISC

Unpacked Size

1.6 kB

Total Files

3

Last publish

Collaborators

  • yse