Created
August 31, 2019 12:21
-
-
Save slavama/008460c49e5919862af924c10d017d6e to your computer and use it in GitHub Desktop.
React-router reverse
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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