Skip to content

Latest commit

 

History

History
70 lines (45 loc) · 1.33 KB

README.md

File metadata and controls

70 lines (45 loc) · 1.33 KB

Welcome to fc-hash-router 👋

Version

The godliest of routers!

Demo

OR SANDBOX IT

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

Edit fc-hash-router-example

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

Show your support

Give a ⭐️ if this project helped you!


Made by Freedcamp with ❤️