{"action":"created","comment":{"url":"https://api.github.com/repos/facebook/react/pulls/comments/220517183","pull_request_review_id":158940051,"id":220517183,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMDUxNzE4Mw==","diff_hunk":"@@ -668,12 +721,21 @@ function mountClassInstance(\n   }\n \n   const instance = workInProgress.stateNode;\n-  const unmaskedContext = getUnmaskedContext(workInProgress, ctor, true);\n-\n   instance.props = newProps;\n   instance.state = workInProgress.memoizedState;\n   instance.refs = emptyRefsObject;\n-  instance.context = getMaskedContext(workInProgress, unmaskedContext);\n+\n+  const contextType = ctor.contextType;\n+  if (\n+    typeof contextType === 'object' &&\n+    contextType !== null &&\n+    typeof contextType.unstable_read === 'function'","path":"packages/react-reconciler/src/ReactFiberClassComponent.js","position":162,"original_position":152,"commit_id":"353cc7e54235e765b8fa4c6e613838883f7fcbc0","original_commit_id":"870c695b589baf6615c0d241b8d04af4b347b77e","user":{"login":"sebmarkbage","id":63648,"node_id":"MDQ6VXNlcjYzNjQ4","avatar_url":"https://avatars2.githubusercontent.com/u/63648?v=4","gravatar_id":"","url":"https://api.github.com/users/sebmarkbage","html_url":"https://github.com/sebmarkbage","followers_url":"https://api.github.com/users/sebmarkbage/followers","following_url":"https://api.github.com/users/sebmarkbage/following{/other_user}","gists_url":"https://api.github.com/users/sebmarkbage/gists{/gist_id}","starred_url":"https://api.github.com/users/sebmarkbage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebmarkbage/subscriptions","organizations_url":"https://api.github.com/users/sebmarkbage/orgs","repos_url":"https://api.github.com/users/sebmarkbage/repos","events_url":"https://api.github.com/users/sebmarkbage/events{/privacy}","received_events_url":"https://api.github.com/users/sebmarkbage/received_events","type":"User","site_admin":false},"body":"Do we need this extra check? Seems like we can just throw.","created_at":"2018-09-26T11:00:32Z","updated_at":"2018-09-26T11:00:54Z","html_url":"https://github.com/facebook/react/pull/13728#discussion_r220517183","pull_request_url":"https://api.github.com/repos/facebook/react/pulls/13728","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/facebook/react/pulls/comments/220517183"},"html":{"href":"https://github.com/facebook/react/pull/13728#discussion_r220517183"},"pull_request":{"href":"https://api.github.com/repos/facebook/react/pulls/13728"}}},"pull_request":{"url":"https://api.github.com/repos/facebook/react/pulls/13728","id":218132801,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE4MTMyODAx","html_url":"https://github.com/facebook/react/pull/13728","diff_url":"https://github.com/facebook/react/pull/13728.diff","patch_url":"https://github.com/facebook/react/pull/13728.patch","issue_url":"https://api.github.com/repos/facebook/react/issues/13728","number":13728,"state":"closed","locked":false,"title":"Support class component static contextType attribute","user":{"login":"bvaughn","id":29597,"node_id":"MDQ6VXNlcjI5NTk3","avatar_url":"https://avatars0.githubusercontent.com/u/29597?v=4","gravatar_id":"","url":"https://api.github.com/users/bvaughn","html_url":"https://github.com/bvaughn","followers_url":"https://api.github.com/users/bvaughn/followers","following_url":"https://api.github.com/users/bvaughn/following{/other_user}","gists_url":"https://api.github.com/users/bvaughn/gists{/gist_id}","starred_url":"https://api.github.com/users/bvaughn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bvaughn/subscriptions","organizations_url":"https://api.github.com/users/bvaughn/orgs","repos_url":"https://api.github.com/users/bvaughn/repos","events_url":"https://api.github.com/users/bvaughn/events{/privacy}","received_events_url":"https://api.github.com/users/bvaughn/received_events","type":"User","site_admin":false},"body":"**Note**: This is an experimental proposal and we haven't published an RFC for it yet. The main motivation is that continuing to support legacy context makes React slower and larger, and we'd like to be able to help everyone migrate to the new context API as soon as possible. Since the new context API is currently too low-level and/or verbose when used in classes, we are considering adding this higher-level API that feels more familiar and will simplify the migration.\r\n\r\n-----\r\n\r\nNew static `contextType` property is supported for class components. This property can be set to the value returned by `React.createContext()` in order to consume the context value via `this.context`, e.g.:\r\n```js\r\nconst LocaleContext = React.createContext('blue');\r\n\r\nclass LocalizedComponent extends React.Component {\r\n  static contextType = LocaleContext;\r\n\r\n  render() {\r\n    return <div>The locale is: {this.context}</div>\r\n  }\r\n}\r\n```\r\n\r\nResolves #13336\r\n\r\nDEV warnings have been added for the following cases:\r\n* Class component has `contextType` instance property.\r\n* Class component has both `contextType` and `contextTypes` static properties.\r\n* Class component has an invalid `contextType` static property (e.g. mistaken `contextType = Context.Provider`).\r\n* Stateless functional component has an (unsupported) `contextType` property.\r\n\r\nNew tests have been added to verify the following:\r\n* Class lifecycle `nextContext` params.\r\n* Class lifecycle `this.context` values.\r\n* Class is forcefully updated (without `shouldComponentUpdate` being called) when context provider updates.\r\n* All of the above DEV warnings.","created_at":"2018-09-25T22:01:40Z","updated_at":"2018-09-26T11:00:54Z","closed_at":"2018-09-25T22:49:47Z","merged_at":"2018-09-25T22:49:47Z","merge_commit_sha":"4b68a6498ba1bd1b81208a9340e0c405f45d4cc4","assignee":null,"assignees":[],"requested_reviewers":[{"login":"gaearon","id":810438,"node_id":"MDQ6VXNlcjgxMDQzOA==","avatar_url":"https://avatars0.githubusercontent.com/u/810438?v=4","gravatar_id":"","url":"https://api.github.com/users/gaearon","html_url":"https://github.com/gaearon","followers_url":"https://api.github.com/users/gaearon/followers","following_url":"https://api.github.com/users/gaearon/following{/other_user}","gists_url":"https://api.github.com/users/gaearon/gists{/gist_id}","starred_url":"https://api.github.com/users/gaearon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gaearon/subscriptions","organizations_url":"https://api.github.com/users/gaearon/orgs","repos_url":"https://api.github.com/users/gaearon/repos","events_url":"https://api.github.com/users/gaearon/events{/privacy}","received_events_url":"https://api.github.com/users/gaearon/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":196858374,"node_id":"MDU6TGFiZWwxOTY4NTgzNzQ=","url":"https://api.github.com/repos/facebook/react/labels/CLA%20Signed","name":"CLA Signed","color":"e7e7e7","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/facebook/react/pulls/13728/commits","review_comments_url":"https://api.github.com/repos/facebook/react/pulls/13728/comments","review_comment_url":"https://api.github.com/repos/facebook/react/pulls/comments{/number}","comments_url":"https://api.github.com/repos/facebook/react/issues/13728/comments","statuses_url":"https://api.github.com/repos/facebook/react/statuses/353cc7e54235e765b8fa4c6e613838883f7fcbc0","head":{"label":"bvaughn:contextType","ref":"contextType","sha":"353cc7e54235e765b8fa4c6e613838883f7fcbc0","user":{"login":"bvaughn","id":29597,"node_id":"MDQ6VXNlcjI5NTk3","avatar_url":"https://avatars0.githubusercontent.com/u/29597?v=4","gravatar_id":"","url":"https://api.github.com/users/bvaughn","html_url":"https://github.com/bvaughn","followers_url":"https://api.github.com/users/bvaughn/followers","following_url":"https://api.github.com/users/bvaughn/following{/other_user}","gists_url":"https://api.github.com/users/bvaughn/gists{/gist_id}","starred_url":"https://api.github.com/users/bvaughn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bvaughn/subscriptions","organizations_url":"https://api.github.com/users/bvaughn/orgs","repos_url":"https://api.github.com/users/bvaughn/repos","events_url":"https://api.github.com/users/bvaughn/events{/privacy}","received_events_url":"https://api.github.com/users/bvaughn/received_events","type":"User","site_admin":false},"repo":{"id":74410855,"node_id":"MDEwOlJlcG9zaXRvcnk3NDQxMDg1NQ==","name":"react","full_name":"bvaughn/react","private":false,"owner":{"login":"bvaughn","id":29597,"node_id":"MDQ6VXNlcjI5NTk3","avatar_url":"https://avatars0.githubusercontent.com/u/29597?v=4","gravatar_id":"","url":"https://api.github.com/users/bvaughn","html_url":"https://github.com/bvaughn","followers_url":"https://api.github.com/users/bvaughn/followers","following_url":"https://api.github.com/users/bvaughn/following{/other_user}","gists_url":"https://api.github.com/users/bvaughn/gists{/gist_id}","starred_url":"https://api.github.com/users/bvaughn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bvaughn/subscriptions","organizations_url":"https://api.github.com/users/bvaughn/orgs","repos_url":"https://api.github.com/users/bvaughn/repos","events_url":"https://api.github.com/users/bvaughn/events{/privacy}","received_events_url":"https://api.github.com/users/bvaughn/received_events","type":"User","site_admin":false},"html_url":"https://github.com/bvaughn/react","description":"A declarative, efficient, and flexible JavaScript library for building user interfaces.","fork":true,"url":"https://api.github.com/repos/bvaughn/react","forks_url":"https://api.github.com/repos/bvaughn/react/forks","keys_url":"https://api.github.com/repos/bvaughn/react/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bvaughn/react/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bvaughn/react/teams","hooks_url":"https://api.github.com/repos/bvaughn/react/hooks","issue_events_url":"https://api.github.com/repos/bvaughn/react/issues/events{/number}","events_url":"https://api.github.com/repos/bvaughn/react/events","assignees_url":"https://api.github.com/repos/bvaughn/react/assignees{/user}","branches_url":"https://api.github.com/repos/bvaughn/react/branches{/branch}","tags_url":"https://api.github.com/repos/bvaughn/react/tags","blobs_url":"https://api.github.com/repos/bvaughn/react/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bvaughn/react/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bvaughn/react/git/refs{/sha}","trees_url":"https://api.github.com/repos/bvaughn/react/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bvaughn/react/statuses/{sha}","languages_url":"https://api.github.com/repos/bvaughn/react/languages","stargazers_url":"https://api.github.com/repos/bvaughn/react/stargazers","contributors_url":"https://api.github.com/repos/bvaughn/react/contributors","subscribers_url":"https://api.github.com/repos/bvaughn/react/subscribers","subscription_url":"https://api.github.com/repos/bvaughn/react/subscription","commits_url":"https://api.github.com/repos/bvaughn/react/commits{/sha}","git_commits_url":"https://api.github.com/repos/bvaughn/react/git/commits{/sha}","comments_url":"https://api.github.com/repos/bvaughn/react/comments{/number}","issue_comment_url":"https://api.github.com/repos/bvaughn/react/issues/comments{/number}","contents_url":"https://api.github.com/repos/bvaughn/react/contents/{+path}","compare_url":"https://api.github.com/repos/bvaughn/react/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bvaughn/react/merges","archive_url":"https://api.github.com/repos/bvaughn/react/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bvaughn/react/downloads","issues_url":"https://api.github.com/repos/bvaughn/react/issues{/number}","pulls_url":"https://api.github.com/repos/bvaughn/react/pulls{/number}","milestones_url":"https://api.github.com/repos/bvaughn/react/milestones{/number}","notifications_url":"https://api.github.com/repos/bvaughn/react/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bvaughn/react/labels{/name}","releases_url":"https://api.github.com/repos/bvaughn/react/releases{/id}","deployments_url":"https://api.github.com/repos/bvaughn/react/deployments","created_at":"2016-11-21T22:18:38Z","updated_at":"2018-08-18T16:28:04Z","pushed_at":"2018-09-26T00:28:36Z","git_url":"git://github.com/bvaughn/react.git","ssh_url":"git@github.com:bvaughn/react.git","clone_url":"https://github.com/bvaughn/react.git","svn_url":"https://github.com/bvaughn/react","homepage":"https://bvaughn.github.io/react/","size":137981,"stargazers_count":5,"watchers_count":5,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1,"open_issues":0,"watchers":5,"default_branch":"master"}},"base":{"label":"facebook:master","ref":"master","sha":"970a34baedcbb3033b271ca8e7e5fb5d7226751d","user":{"login":"facebook","id":69631,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY5NjMx","avatar_url":"https://avatars3.githubusercontent.com/u/69631?v=4","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"repo":{"id":10270250,"node_id":"MDEwOlJlcG9zaXRvcnkxMDI3MDI1MA==","name":"react","full_name":"facebook/react","private":false,"owner":{"login":"facebook","id":69631,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY5NjMx","avatar_url":"https://avatars3.githubusercontent.com/u/69631?v=4","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/facebook/react","description":"A declarative, efficient, and flexible JavaScript library for building user interfaces.","fork":false,"url":"https://api.github.com/repos/facebook/react","forks_url":"https://api.github.com/repos/facebook/react/forks","keys_url":"https://api.github.com/repos/facebook/react/keys{/key_id}","collaborators_url":"https://api.github.com/repos/facebook/react/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/facebook/react/teams","hooks_url":"https://api.github.com/repos/facebook/react/hooks","issue_events_url":"https://api.github.com/repos/facebook/react/issues/events{/number}","events_url":"https://api.github.com/repos/facebook/react/events","assignees_url":"https://api.github.com/repos/facebook/react/assignees{/user}","branches_url":"https://api.github.com/repos/facebook/react/branches{/branch}","tags_url":"https://api.github.com/repos/facebook/react/tags","blobs_url":"https://api.github.com/repos/facebook/react/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/facebook/react/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/facebook/react/git/refs{/sha}","trees_url":"https://api.github.com/repos/facebook/react/git/trees{/sha}","statuses_url":"https://api.github.com/repos/facebook/react/statuses/{sha}","languages_url":"https://api.github.com/repos/facebook/react/languages","stargazers_url":"https://api.github.com/repos/facebook/react/stargazers","contributors_url":"https://api.github.com/repos/facebook/react/contributors","subscribers_url":"https://api.github.com/repos/facebook/react/subscribers","subscription_url":"https://api.github.com/repos/facebook/react/subscription","commits_url":"https://api.github.com/repos/facebook/react/commits{/sha}","git_commits_url":"https://api.github.com/repos/facebook/react/git/commits{/sha}","comments_url":"https://api.github.com/repos/facebook/react/comments{/number}","issue_comment_url":"https://api.github.com/repos/facebook/react/issues/comments{/number}","contents_url":"https://api.github.com/repos/facebook/react/contents/{+path}","compare_url":"https://api.github.com/repos/facebook/react/compare/{base}...{head}","merges_url":"https://api.github.com/repos/facebook/react/merges","archive_url":"https://api.github.com/repos/facebook/react/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/facebook/react/downloads","issues_url":"https://api.github.com/repos/facebook/react/issues{/number}","pulls_url":"https://api.github.com/repos/facebook/react/pulls{/number}","milestones_url":"https://api.github.com/repos/facebook/react/milestones{/number}","notifications_url":"https://api.github.com/repos/facebook/react/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/facebook/react/labels{/name}","releases_url":"https://api.github.com/repos/facebook/react/releases{/id}","deployments_url":"https://api.github.com/repos/facebook/react/deployments","created_at":"2013-05-24T16:15:54Z","updated_at":"2018-09-26T10:53:30Z","pushed_at":"2018-09-26T09:38:11Z","git_url":"git://github.com/facebook/react.git","ssh_url":"git@github.com:facebook/react.git","clone_url":"https://github.com/facebook/react.git","svn_url":"https://github.com/facebook/react","homepage":"https://reactjs.org","size":138555,"stargazers_count":111984,"watchers_count":111984,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":20048,"mirror_url":null,"archived":false,"open_issues_count":380,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":20048,"open_issues":380,"watchers":111984,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/facebook/react/pulls/13728"},"html":{"href":"https://github.com/facebook/react/pull/13728"},"issue":{"href":"https://api.github.com/repos/facebook/react/issues/13728"},"comments":{"href":"https://api.github.com/repos/facebook/react/issues/13728/comments"},"review_comments":{"href":"https://api.github.com/repos/facebook/react/pulls/13728/comments"},"review_comment":{"href":"https://api.github.com/repos/facebook/react/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/facebook/react/pulls/13728/commits"},"statuses":{"href":"https://api.github.com/repos/facebook/react/statuses/353cc7e54235e765b8fa4c6e613838883f7fcbc0"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"sebmarkbage"}}