{"action":"closed","issue":{"url":"https://api.github.com/repos/reactjs/react-router-redux/issues/297","repository_url":"https://api.github.com/repos/reactjs/react-router-redux","labels_url":"https://api.github.com/repos/reactjs/react-router-redux/issues/297/labels{/name}","comments_url":"https://api.github.com/repos/reactjs/react-router-redux/issues/297/comments","events_url":"https://api.github.com/repos/reactjs/react-router-redux/issues/297/events","html_url":"https://github.com/reactjs/react-router-redux/issues/297","id":135703931,"number":297,"title":"There needs to be a way to get at the params of a CHANGE_LOCATION action","user":{"login":"leidegre","id":63085,"avatar_url":"https://avatars.githubusercontent.com/u/63085?v=3","gravatar_id":"","url":"https://api.github.com/users/leidegre","html_url":"https://github.com/leidegre","followers_url":"https://api.github.com/users/leidegre/followers","following_url":"https://api.github.com/users/leidegre/following{/other_user}","gists_url":"https://api.github.com/users/leidegre/gists{/gist_id}","starred_url":"https://api.github.com/users/leidegre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leidegre/subscriptions","organizations_url":"https://api.github.com/users/leidegre/orgs","repos_url":"https://api.github.com/users/leidegre/repos","events_url":"https://api.github.com/users/leidegre/events{/privacy}","received_events_url":"https://api.github.com/users/leidegre/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-02-23T10:55:40Z","updated_at":"2016-02-23T17:24:21Z","closed_at":"2016-02-23T17:24:21Z","body":"The routes define an important aspect of the route namely the `params`. I've looked around and for this to work the routes need to be passed to the middleware.\r\n\r\nInternally the way `react-router` does this is beyond me atm but I think this is doable. I'll update this issue with my progress and maybe provide a pull request for it.\r\n\r\nThe reason I think this is important is that the routes already define this structure and the logic for parsing routes in defined in `react-router` replicating this work (while it's easy to grep some like an ID from an URI) I'd very much prefer if these things were not dependant on each other.\r\n\r\nIn essence this is what I want.\r\n\r\n~~~\r\nimport matchRoutes from 'react-router/lib/matchRoutes'\r\n\r\nconst routeConfig = [\r\n  ...\r\n]\r\n\r\nconst routeParamsMiddleware = store => next => action => {\r\n  if (action.type === '@@router/LOCATION_CHANGE') {\r\n    matchRoutes(routeConfig, action.payload, (error, state) => {\r\n      action.routes = state.routes\r\n      action.params = state.params\r\n      next(action)\r\n    })\r\n    return\r\n  }\r\n  return next(action)\r\n}\r\n~~~\r\n\r\nThe obvious caveat is that this depends on an private react-router API, `matchRoutes`..."}}