Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/acro5piano/onemile-router
A react router alternative
https://github.com/acro5piano/onemile-router
react react-router router
Last synced: 8 days ago
JSON representation
A react router alternative
- Host: GitHub
- URL: https://github.com/acro5piano/onemile-router
- Owner: acro5piano
- Created: 2018-06-08T14:10:58.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-06-08T16:45:13.000Z (over 6 years ago)
- Last Synced: 2024-10-12T06:43:25.626Z (about 1 month ago)
- Topics: react, react-router, router
- Language: TypeScript
- Homepage:
- Size: 162 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![npm version](https://badge.fury.io/js/onemile-router.svg)](https://badge.fury.io/js/onemile-router)
# Onemile router
A React Router alternative.
Onemile router provides dead simple and easy-to-manage routing.
![demo](https://github.com/acro5piano/onemile-router/blob/master/demo.gif)
# Install
```
npm install onemile-router
```or if you use yarn:
```
yarn add onemile-router
```# Example
Note: Onemile router have not published to NPM yet.
```ts
import * as React from 'react'
import { Router, Route } from 'onemile-router'const Dashboard = () =>
Dashboard
const Message = () =>Messageexport default class App extends React.Component {
router: RouteronRouteChange = ({ from, to }) => {
console.log(from)
}setRouter = (router: Router) => {
this.router = router
}toDashboard = () => this.router.push('/')
toMessage = () => this.router.push('/message')
render() {
return (
Onemile router example
Dashboard
Message
)
}
}
```# TODO
- [x] Publish to NPM
- [ ] Write test
- [ ] Route parameter
- [ ] Provide `withRouter()` HOC