Skip to content

agrublev/fc-hash-router

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 ❤️

About

The most amazing hash router of all time

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published