Created
February 25, 2016 13:10
-
-
Save stuartc/def41f2e1c9b36fdb44d to your computer and use it in GitHub Desktop.
React Router Pattern Match by Hand
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 { matchPattern } from "react-router/lib/PatternUtils"; | |
import { zipObject } from "lodash"; | |
const matchedPattern = matchPattern("/receipts/:id/inspect", location.pathname) | |
const params = zipObject(matchedPattern.paramNames, matchedPattern.paramValues) | |
console.log(params); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment