{"action":"closed","issue":{"url":"https://api.github.com/repos/ReactTraining/react-router/issues/4005","repository_url":"https://api.github.com/repos/ReactTraining/react-router","labels_url":"https://api.github.com/repos/ReactTraining/react-router/issues/4005/labels{/name}","comments_url":"https://api.github.com/repos/ReactTraining/react-router/issues/4005/comments","events_url":"https://api.github.com/repos/ReactTraining/react-router/issues/4005/events","html_url":"https://github.com/ReactTraining/react-router/issues/4005","id":181522640,"number":4005,"title":"V4 Router methods in props","user":{"login":"porfirioribeiro","id":499246,"avatar_url":"https://avatars.githubusercontent.com/u/499246?v=3","gravatar_id":"","url":"https://api.github.com/users/porfirioribeiro","html_url":"https://github.com/porfirioribeiro","followers_url":"https://api.github.com/users/porfirioribeiro/followers","following_url":"https://api.github.com/users/porfirioribeiro/following{/other_user}","gists_url":"https://api.github.com/users/porfirioribeiro/gists{/gist_id}","starred_url":"https://api.github.com/users/porfirioribeiro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/porfirioribeiro/subscriptions","organizations_url":"https://api.github.com/users/porfirioribeiro/orgs","repos_url":"https://api.github.com/users/porfirioribeiro/repos","events_url":"https://api.github.com/users/porfirioribeiro/events{/privacy}","received_events_url":"https://api.github.com/users/porfirioribeiro/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":24,"created_at":"2016-10-06T20:53:04Z","updated_at":"2016-10-26T02:08:47Z","closed_at":"2016-10-26T02:08:47Z","body":"In my project i need to call ```transitionTo(\"/some/path\")``` in a function to go to a different location.\r\n\r\nThat function is available in the router context, why not pass it down as a prop to the matched component?\r\n\r\nMy solution was to wrap match with the `router` from the context\r\n\r\n```jsx\r\nimport React from 'react';\r\nimport {Match, propTypes} from 'react-router';\r\n\r\nconst CustomMatch = (props, context) => {\r\n  return (\r\n    <Match {...props} render={(matchProps) => {\r\n      const newProps = {...matchProps, router: context.router, ...props};\r\n      if (props.component)\r\n        return React.createElement(props.component, newProps);\r\n      else\r\n        return props.render(newProps);\r\n    }}/>\r\n  );\r\n};\r\n\r\nCustomMatch.contextTypes = {\r\n  router: propTypes.routerContext\r\n};\r\nexport default CustomMatch;\r\n``` "}}
{"actor":{"display_login":"ryanflorence"}}