https://github.com/agrublev/fc-hash-router
The most amazing hash router of all time
https://github.com/agrublev/fc-hash-router
Last synced: over 1 year ago
JSON representation
The most amazing hash router of all time
- Host: GitHub
- URL: https://github.com/agrublev/fc-hash-router
- Owner: agrublev
- Created: 2020-05-18T00:39:35.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-06-28T13:00:41.000Z (about 2 years ago)
- Last Synced: 2025-03-21T09:06:51.041Z (over 1 year ago)
- Language: JavaScript
- Homepage: https://fc-hash-router.surge.sh
- Size: 474 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Welcome to fc-hash-router 👋
> The godliest of routers!
### ✨ [Demo](https://fc-hash-router.surge.sh)
**OR SANDBOX IT**
https://codesandbox.io/s/fc-hash-router-example-3z0bf
[](https://codesandbox.io/s/fc-hash-router-example-3z0bf?fontsize=14&hidenavigation=1&theme=dark)
## Install
```sh
yarn add fc-hash-router -D
```
## Usage
```js
import { HashRouter } from "fc-hash-router";
HashRouter.route(`products/:firstVar/:someVar/bobby/#num/random`, (data) => {
console.info(data);
});
// Or cooler
HashRouter.route(`products/:firstVar/:someVar/bobby/#num/random`, ({firstVar,someVar,num}) => {
console.info({firstVar,someVar,num});
});
```
### Then use normal anchor like this
```html
TEST
```
### OR With Javascript
```js
HashRouter.navigate(`/products/12/22/bobby/123/random`);
```
### To unregister a route
```js
HashRouter.routeOff(`new/#userId`);
```
THAT EASY!
## Author
👤 **Angel Grablev**
- Website: https://freedcamp.com
- Github: [@agrublev](https://github.com/agrublev)
## Show your support
Give a ⭐️ if this project helped you!
---
Made by Freedcamp with ❤️