{"action":"created","issue":{"url":"https://api.github.com/repos/ReactTraining/react-router/issues/3896","repository_url":"https://api.github.com/repos/ReactTraining/react-router","labels_url":"https://api.github.com/repos/ReactTraining/react-router/issues/3896/labels{/name}","comments_url":"https://api.github.com/repos/ReactTraining/react-router/issues/3896/comments","events_url":"https://api.github.com/repos/ReactTraining/react-router/issues/3896/events","html_url":"https://github.com/ReactTraining/react-router/pull/3896","id":177612569,"number":3896,"title":"Allow <Link> to be used outside of Router, add warning","user":{"login":"Connorelsea","id":1844458,"avatar_url":"https://avatars.githubusercontent.com/u/1844458?v=3","gravatar_id":"","url":"https://api.github.com/users/Connorelsea","html_url":"https://github.com/Connorelsea","followers_url":"https://api.github.com/users/Connorelsea/followers","following_url":"https://api.github.com/users/Connorelsea/following{/other_user}","gists_url":"https://api.github.com/users/Connorelsea/gists{/gist_id}","starred_url":"https://api.github.com/users/Connorelsea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Connorelsea/subscriptions","organizations_url":"https://api.github.com/users/Connorelsea/orgs","repos_url":"https://api.github.com/users/Connorelsea/repos","events_url":"https://api.github.com/users/Connorelsea/events{/privacy}","received_events_url":"https://api.github.com/users/Connorelsea/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-09-17T22:04:12Z","updated_at":"2016-09-18T03:21:17Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ReactTraining/react-router/pulls/3896","html_url":"https://github.com/ReactTraining/react-router/pull/3896","diff_url":"https://github.com/ReactTraining/react-router/pull/3896.diff","patch_url":"https://github.com/ReactTraining/react-router/pull/3896.patch"},"body":"Fixes #3889\r\n\r\nPreviously, using a Link outside of the Router would break the program. The breaking was caused by the inability to find location when outside of the router context. This PR fixes that by checking if the context contains the router, and if not, marking \"isActive\" as false by default. This introduces the assumption that all <Links> outside of the router are not active.\r\n\r\nThis also adds a warning to indicate that the user is using the <Link> is being used outside of the error. I am not exactly sure what copy to use in the error.\r\n\r\nAs of right now, since there is no invariant in handleClick, a <Link> can be \"used\" outside of a router. It simply reloads the page based on the href.\r\n\r\nThis is my first time contributing, so let me know if there is anything else that needs to be changed or added to resolve this issue."},"comment":{"url":"https://api.github.com/repos/ReactTraining/react-router/issues/comments/247822481","html_url":"https://github.com/ReactTraining/react-router/pull/3896#issuecomment-247822481","issue_url":"https://api.github.com/repos/ReactTraining/react-router/issues/3896","id":247822481,"user":{"login":"Connorelsea","id":1844458,"avatar_url":"https://avatars.githubusercontent.com/u/1844458?v=3","gravatar_id":"","url":"https://api.github.com/users/Connorelsea","html_url":"https://github.com/Connorelsea","followers_url":"https://api.github.com/users/Connorelsea/followers","following_url":"https://api.github.com/users/Connorelsea/following{/other_user}","gists_url":"https://api.github.com/users/Connorelsea/gists{/gist_id}","starred_url":"https://api.github.com/users/Connorelsea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Connorelsea/subscriptions","organizations_url":"https://api.github.com/users/Connorelsea/orgs","repos_url":"https://api.github.com/users/Connorelsea/repos","events_url":"https://api.github.com/users/Connorelsea/events{/privacy}","received_events_url":"https://api.github.com/users/Connorelsea/received_events","type":"User","site_admin":false},"created_at":"2016-09-18T03:21:17Z","updated_at":"2016-09-18T03:21:17Z","body":"Rebased to remove the warning. Now this commit refactors the method signature of getIsActive to allow for the sniffing of router context. Then getIsActive returns false if the router is not available on the context. It does this without any warning to the user. This also refactors away verbosity from the className assignment when returning the final anchor tag.\r\n\r\nAs of right now clicking on this link outside of the router just follows its href. It seems like there is no problem occurring with handling onClick."}}
{"actor":{"display_login":"Connorelsea"}}