I would like to get the current parameters outside the component, and as far as I can tell, React Router does not provide a convenient way to do this.
Sometime earlier than 0.13, the router had getCurrentParams (), which I used.
Now the best thing I can understand:
// Copy and past contents of PatternUtils into my project var PatternUtils = require('<copy of PatternUtils.js>') const { remainingPathname, paramNames, paramValues } = PatternUtils.matchPattern( "<copy of path pattern with params I am interested in>", window.location.pathname);
Is there a way to do this using React router?
react-router
misterwilliam
source share