An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# Welcome to fc-hash-router 👋


Version

> The godliest of routers!

### ✨ [Demo](https://fc-hash-router.surge.sh)

**OR SANDBOX IT**

https://codesandbox.io/s/fc-hash-router-example-3z0bf

[![Edit fc-hash-router-example](https://codesandbox.io/static/img/play-codesandbox.svg)](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 ❤️