{"action":"opened","number":52,"pull_request":{"url":"https://api.github.com/repos/larrymyers/react-mini-router/pulls/52","id":56672501,"html_url":"https://github.com/larrymyers/react-mini-router/pull/52","diff_url":"https://github.com/larrymyers/react-mini-router/pull/52.diff","patch_url":"https://github.com/larrymyers/react-mini-router/pull/52.patch","issue_url":"https://api.github.com/repos/larrymyers/react-mini-router/issues/52","number":52,"state":"open","locked":false,"title":"Add a way to stop navigation via React onClick handler","user":{"login":"hayesgm","id":271024,"avatar_url":"https://avatars.githubusercontent.com/u/271024?v=3","gravatar_id":"","url":"https://api.github.com/users/hayesgm","html_url":"https://github.com/hayesgm","followers_url":"https://api.github.com/users/hayesgm/followers","following_url":"https://api.github.com/users/hayesgm/following{/other_user}","gists_url":"https://api.github.com/users/hayesgm/gists{/gist_id}","starred_url":"https://api.github.com/users/hayesgm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hayesgm/subscriptions","organizations_url":"https://api.github.com/users/hayesgm/orgs","repos_url":"https://api.github.com/users/hayesgm/repos","events_url":"https://api.github.com/users/hayesgm/events{/privacy}","received_events_url":"https://api.github.com/users/hayesgm/received_events","type":"User","site_admin":false},"body":"This is a simple patch to allow a React `onClick` handler to prevent React Mini Router from navigating after a click to an anchor tag. Here's an example of how this works:\r\n\r\n```html\r\nfunction handleClick(e) {\r\n  // Don't navigate unless user prop is set\r\n  if (this.props.user === null) {\r\n    e.nativeEvent.stopNavigation = true\r\n  }\r\n}\r\n\r\n<a href=\"/user\" onClick={handleClick} />\r\n```\r\n\r\nThe core reason for this is that for many applications, we want to ensure the link structure is correct for bots. But oftentimes, I still want to include logic surrounding what to do when there's a click. This may be to prevent the click, or to call out to our analytics system before navigating away from the screen.\r\n\r\nI won't be offended if we think this doesn't belong in this project. There does not seem to be another good way of handling this (e.g. via after the navigation, or through hacks such as setting the `target` attribute). Happy for all feedback here.","created_at":"2016-01-20T21:50:06Z","updated_at":"2016-01-20T21:50:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/larrymyers/react-mini-router/pulls/52/commits","review_comments_url":"https://api.github.com/repos/larrymyers/react-mini-router/pulls/52/comments","review_comment_url":"https://api.github.com/repos/larrymyers/react-mini-router/pulls/comments{/number}","comments_url":"https://api.github.com/repos/larrymyers/react-mini-router/issues/52/comments","statuses_url":"https://api.github.com/repos/larrymyers/react-mini-router/statuses/e54aaf741b59b260bf291420b422011894213ca0","head":{"label":"hayesgm:stop-navigation","ref":"stop-navigation","sha":"e54aaf741b59b260bf291420b422011894213ca0","user":{"login":"hayesgm","id":271024,"avatar_url":"https://avatars.githubusercontent.com/u/271024?v=3","gravatar_id":"","url":"https://api.github.com/users/hayesgm","html_url":"https://github.com/hayesgm","followers_url":"https://api.github.com/users/hayesgm/followers","following_url":"https://api.github.com/users/hayesgm/following{/other_user}","gists_url":"https://api.github.com/users/hayesgm/gists{/gist_id}","starred_url":"https://api.github.com/users/hayesgm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hayesgm/subscriptions","organizations_url":"https://api.github.com/users/hayesgm/orgs","repos_url":"https://api.github.com/users/hayesgm/repos","events_url":"https://api.github.com/users/hayesgm/events{/privacy}","received_events_url":"https://api.github.com/users/hayesgm/received_events","type":"User","site_admin":false},"repo":{"id":49987627,"name":"react-mini-router","full_name":"hayesgm/react-mini-router","owner":{"login":"hayesgm","id":271024,"avatar_url":"https://avatars.githubusercontent.com/u/271024?v=3","gravatar_id":"","url":"https://api.github.com/users/hayesgm","html_url":"https://github.com/hayesgm","followers_url":"https://api.github.com/users/hayesgm/followers","following_url":"https://api.github.com/users/hayesgm/following{/other_user}","gists_url":"https://api.github.com/users/hayesgm/gists{/gist_id}","starred_url":"https://api.github.com/users/hayesgm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hayesgm/subscriptions","organizations_url":"https://api.github.com/users/hayesgm/orgs","repos_url":"https://api.github.com/users/hayesgm/repos","events_url":"https://api.github.com/users/hayesgm/events{/privacy}","received_events_url":"https://api.github.com/users/hayesgm/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hayesgm/react-mini-router","description":"A minimal URL router for React.js","fork":true,"url":"https://api.github.com/repos/hayesgm/react-mini-router","forks_url":"https://api.github.com/repos/hayesgm/react-mini-router/forks","keys_url":"https://api.github.com/repos/hayesgm/react-mini-router/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hayesgm/react-mini-router/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hayesgm/react-mini-router/teams","hooks_url":"https://api.github.com/repos/hayesgm/react-mini-router/hooks","issue_events_url":"https://api.github.com/repos/hayesgm/react-mini-router/issues/events{/number}","events_url":"https://api.github.com/repos/hayesgm/react-mini-router/events","assignees_url":"https://api.github.com/repos/hayesgm/react-mini-router/assignees{/user}","branches_url":"https://api.github.com/repos/hayesgm/react-mini-router/branches{/branch}","tags_url":"https://api.github.com/repos/hayesgm/react-mini-router/tags","blobs_url":"https://api.github.com/repos/hayesgm/react-mini-router/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hayesgm/react-mini-router/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hayesgm/react-mini-router/git/refs{/sha}","trees_url":"https://api.github.com/repos/hayesgm/react-mini-router/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hayesgm/react-mini-router/statuses/{sha}","languages_url":"https://api.github.com/repos/hayesgm/react-mini-router/languages","stargazers_url":"https://api.github.com/repos/hayesgm/react-mini-router/stargazers","contributors_url":"https://api.github.com/repos/hayesgm/react-mini-router/contributors","subscribers_url":"https://api.github.com/repos/hayesgm/react-mini-router/subscribers","subscription_url":"https://api.github.com/repos/hayesgm/react-mini-router/subscription","commits_url":"https://api.github.com/repos/hayesgm/react-mini-router/commits{/sha}","git_commits_url":"https://api.github.com/repos/hayesgm/react-mini-router/git/commits{/sha}","comments_url":"https://api.github.com/repos/hayesgm/react-mini-router/comments{/number}","issue_comment_url":"https://api.github.com/repos/hayesgm/react-mini-router/issues/comments{/number}","contents_url":"https://api.github.com/repos/hayesgm/react-mini-router/contents/{+path}","compare_url":"https://api.github.com/repos/hayesgm/react-mini-router/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hayesgm/react-mini-router/merges","archive_url":"https://api.github.com/repos/hayesgm/react-mini-router/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hayesgm/react-mini-router/downloads","issues_url":"https://api.github.com/repos/hayesgm/react-mini-router/issues{/number}","pulls_url":"https://api.github.com/repos/hayesgm/react-mini-router/pulls{/number}","milestones_url":"https://api.github.com/repos/hayesgm/react-mini-router/milestones{/number}","notifications_url":"https://api.github.com/repos/hayesgm/react-mini-router/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hayesgm/react-mini-router/labels{/name}","releases_url":"https://api.github.com/repos/hayesgm/react-mini-router/releases{/id}","created_at":"2016-01-19T22:28:25Z","updated_at":"2016-01-19T22:28:26Z","pushed_at":"2016-01-20T21:44:18Z","git_url":"git://github.com/hayesgm/react-mini-router.git","ssh_url":"git@github.com:hayesgm/react-mini-router.git","clone_url":"https://github.com/hayesgm/react-mini-router.git","svn_url":"https://github.com/hayesgm/react-mini-router","homepage":"","size":359,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"larrymyers:master","ref":"master","sha":"d9bcbbecfdd8e91d316d4302bf3bbbe046d9f04f","user":{"login":"larrymyers","id":50755,"avatar_url":"https://avatars.githubusercontent.com/u/50755?v=3","gravatar_id":"","url":"https://api.github.com/users/larrymyers","html_url":"https://github.com/larrymyers","followers_url":"https://api.github.com/users/larrymyers/followers","following_url":"https://api.github.com/users/larrymyers/following{/other_user}","gists_url":"https://api.github.com/users/larrymyers/gists{/gist_id}","starred_url":"https://api.github.com/users/larrymyers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larrymyers/subscriptions","organizations_url":"https://api.github.com/users/larrymyers/orgs","repos_url":"https://api.github.com/users/larrymyers/repos","events_url":"https://api.github.com/users/larrymyers/events{/privacy}","received_events_url":"https://api.github.com/users/larrymyers/received_events","type":"User","site_admin":false},"repo":{"id":22525103,"name":"react-mini-router","full_name":"larrymyers/react-mini-router","owner":{"login":"larrymyers","id":50755,"avatar_url":"https://avatars.githubusercontent.com/u/50755?v=3","gravatar_id":"","url":"https://api.github.com/users/larrymyers","html_url":"https://github.com/larrymyers","followers_url":"https://api.github.com/users/larrymyers/followers","following_url":"https://api.github.com/users/larrymyers/following{/other_user}","gists_url":"https://api.github.com/users/larrymyers/gists{/gist_id}","starred_url":"https://api.github.com/users/larrymyers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larrymyers/subscriptions","organizations_url":"https://api.github.com/users/larrymyers/orgs","repos_url":"https://api.github.com/users/larrymyers/repos","events_url":"https://api.github.com/users/larrymyers/events{/privacy}","received_events_url":"https://api.github.com/users/larrymyers/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/larrymyers/react-mini-router","description":"A minimal URL router for React.js","fork":false,"url":"https://api.github.com/repos/larrymyers/react-mini-router","forks_url":"https://api.github.com/repos/larrymyers/react-mini-router/forks","keys_url":"https://api.github.com/repos/larrymyers/react-mini-router/keys{/key_id}","collaborators_url":"https://api.github.com/repos/larrymyers/react-mini-router/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/larrymyers/react-mini-router/teams","hooks_url":"https://api.github.com/repos/larrymyers/react-mini-router/hooks","issue_events_url":"https://api.github.com/repos/larrymyers/react-mini-router/issues/events{/number}","events_url":"https://api.github.com/repos/larrymyers/react-mini-router/events","assignees_url":"https://api.github.com/repos/larrymyers/react-mini-router/assignees{/user}","branches_url":"https://api.github.com/repos/larrymyers/react-mini-router/branches{/branch}","tags_url":"https://api.github.com/repos/larrymyers/react-mini-router/tags","blobs_url":"https://api.github.com/repos/larrymyers/react-mini-router/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/larrymyers/react-mini-router/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/larrymyers/react-mini-router/git/refs{/sha}","trees_url":"https://api.github.com/repos/larrymyers/react-mini-router/git/trees{/sha}","statuses_url":"https://api.github.com/repos/larrymyers/react-mini-router/statuses/{sha}","languages_url":"https://api.github.com/repos/larrymyers/react-mini-router/languages","stargazers_url":"https://api.github.com/repos/larrymyers/react-mini-router/stargazers","contributors_url":"https://api.github.com/repos/larrymyers/react-mini-router/contributors","subscribers_url":"https://api.github.com/repos/larrymyers/react-mini-router/subscribers","subscription_url":"https://api.github.com/repos/larrymyers/react-mini-router/subscription","commits_url":"https://api.github.com/repos/larrymyers/react-mini-router/commits{/sha}","git_commits_url":"https://api.github.com/repos/larrymyers/react-mini-router/git/commits{/sha}","comments_url":"https://api.github.com/repos/larrymyers/react-mini-router/comments{/number}","issue_comment_url":"https://api.github.com/repos/larrymyers/react-mini-router/issues/comments{/number}","contents_url":"https://api.github.com/repos/larrymyers/react-mini-router/contents/{+path}","compare_url":"https://api.github.com/repos/larrymyers/react-mini-router/compare/{base}...{head}","merges_url":"https://api.github.com/repos/larrymyers/react-mini-router/merges","archive_url":"https://api.github.com/repos/larrymyers/react-mini-router/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/larrymyers/react-mini-router/downloads","issues_url":"https://api.github.com/repos/larrymyers/react-mini-router/issues{/number}","pulls_url":"https://api.github.com/repos/larrymyers/react-mini-router/pulls{/number}","milestones_url":"https://api.github.com/repos/larrymyers/react-mini-router/milestones{/number}","notifications_url":"https://api.github.com/repos/larrymyers/react-mini-router/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/larrymyers/react-mini-router/labels{/name}","releases_url":"https://api.github.com/repos/larrymyers/react-mini-router/releases{/id}","created_at":"2014-08-01T19:33:36Z","updated_at":"2016-01-14T09:28:08Z","pushed_at":"2015-11-24T21:41:17Z","git_url":"git://github.com/larrymyers/react-mini-router.git","ssh_url":"git@github.com:larrymyers/react-mini-router.git","clone_url":"https://github.com/larrymyers/react-mini-router.git","svn_url":"https://github.com/larrymyers/react-mini-router","homepage":"","size":371,"stargazers_count":196,"watchers_count":196,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":27,"mirror_url":null,"open_issues_count":6,"forks":27,"open_issues":6,"watchers":196,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/larrymyers/react-mini-router/pulls/52"},"html":{"href":"https://github.com/larrymyers/react-mini-router/pull/52"},"issue":{"href":"https://api.github.com/repos/larrymyers/react-mini-router/issues/52"},"comments":{"href":"https://api.github.com/repos/larrymyers/react-mini-router/issues/52/comments"},"review_comments":{"href":"https://api.github.com/repos/larrymyers/react-mini-router/pulls/52/comments"},"review_comment":{"href":"https://api.github.com/repos/larrymyers/react-mini-router/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/larrymyers/react-mini-router/pulls/52/commits"},"statuses":{"href":"https://api.github.com/repos/larrymyers/react-mini-router/statuses/e54aaf741b59b260bf291420b422011894213ca0"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":12,"deletions":2,"changed_files":4}}