Skip to content

Instantly share code, notes, and snippets.

@jide
Created April 1, 2022 20:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jide/d765f1eaa55de879676fd47ffa80a23e to your computer and use it in GitHub Desktop.
Save jide/d765f1eaa55de879676fd47ffa80a23e to your computer and use it in GitHub Desktop.
import page from 'page';
export const router = {
initialize(routes) {
Object.keys(routes).forEach(url => {
page(url, ({ params }) => routes[url](params));
});
page.start();
},
open: url => page.show(url)
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment