A simple js router designed to solve one problem outside of any other frameworks like React, Angular, or Vue
npm install --save @kevindurb/router
;const app = ;app;app;app; // load person with id: 256app; // showing people!
offMatch let you add a listener for ANY route matches. You can also
pass strings in instead of callbacks as the second argument to
add that get passed into
onMatch callback. This works great with setting the current route in a
global store like redux or setState in react.
;const app = ;app;app;app;app; // person! 256app; // people!!
pathFromRoute will let you dry up your code with reproducable routes
;const PERSON_ROUTE = '/people/:id';const app = ;app;app; // person! 256
Usage with history package
npm install --save history
;;const history = ;const app = ;app;app;history;history; // load person with id: 65