fc-hash-router
v1.0.8
Published
The godliest of routers!
Downloads
6
Readme
Welcome to fc-hash-router 👋
The godliest of routers!
✨ Demo
OR SANDBOX IT
https://codesandbox.io/s/fc-hash-router-example-3z0bf
Install
yarn add fc-hash-router -D
Usage
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
<a href="#/products/12/22/bobby/123/random">TEST</a>
OR With Javascript
HashRouter.navigate(`/products/12/22/bobby/123/random`);
To unregister a route
HashRouter.routeOff(`new/#userId`);
THAT EASY!
Author
👤 Angel Grablev
- Website: https://freedcamp.com
- Github: @agrublev
Show your support
Give a ⭐️ if this project helped you!
Made by Freedcamp with ❤️