Skip to content

Instantly share code, notes, and snippets.

@slavama
Created August 31, 2019 12:21
Show Gist options
  • Save slavama/008460c49e5919862af924c10d017d6e to your computer and use it in GitHub Desktop.
Save slavama/008460c49e5919862af924c10d017d6e to your computer and use it in GitHub Desktop.
React-router reverse
import pathToRegexp from 'path-to-regexp';
export const reverse = (path, kwargs={}) => {
const toPath = pathToRegexp.compile(path);
return toPath(kwargs);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment