{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react/issues/7702","repository_url":"https://api.github.com/repos/facebook/react","labels_url":"https://api.github.com/repos/facebook/react/issues/7702/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react/issues/7702/comments","events_url":"https://api.github.com/repos/facebook/react/issues/7702/events","html_url":"https://github.com/facebook/react/pull/7702","id":176406873,"number":7702,"title":"(WIP) Separate internal class for functional components","user":{"login":"gaearon","id":810438,"avatar_url":"https://avatars.githubusercontent.com/u/810438?v=3","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},"labels":[{"url":"https://api.github.com/repos/facebook/react/labels/CLA%20Signed","name":"CLA Signed","color":"e7e7e7"},{"url":"https://api.github.com/repos/facebook/react/labels/GH%20Review:%20review-needed","name":"GH Review: review-needed","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-09-12T15:31:13Z","updated_at":"2016-09-12T18:48:48Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/facebook/react/pulls/7702","html_url":"https://github.com/facebook/react/pull/7702","diff_url":"https://github.com/facebook/react/pull/7702.diff","patch_url":"https://github.com/facebook/react/pull/7702.patch"},"body":"For fun, I tried to make a separate internal class for functional components.\r\nPreviously this was attempted in #3995.\r\n\r\nThis is work in progress. I’d like to measure perf implications of this but haven’t had the time yet.\r\nThe one feature that I don’t support here is factory components:\r\n\r\n```js\r\nfunction Foo(props) {\r\n  return {\r\n    render() { return <div />\r\n  }\r\n}\r\n```\r\n\r\nThey are very inconvenient with our OOP internal hierarchy because we don’t know whether we’re dealing with a functional or a factory component until we call the function at least once.\r\n\r\nI assume this is the same reason #3995 got shoot down. However I don’t think I’ve ever seen a “factory component” in the wild and I’m not convinced in the utility of supporting them. Who are their users?\r\n\r\nShallow rendering is also broken in this PR, but I think it’s fixable."},"comment":{"url":"https://api.github.com/repos/facebook/react/issues/comments/246450846","html_url":"https://github.com/facebook/react/pull/7702#issuecomment-246450846","issue_url":"https://api.github.com/repos/facebook/react/issues/7702","id":246450846,"user":{"login":"spicyj","id":6820,"avatar_url":"https://avatars.githubusercontent.com/u/6820?v=3","gravatar_id":"","url":"https://api.github.com/users/spicyj","html_url":"https://github.com/spicyj","followers_url":"https://api.github.com/users/spicyj/followers","following_url":"https://api.github.com/users/spicyj/following{/other_user}","gists_url":"https://api.github.com/users/spicyj/gists{/gist_id}","starred_url":"https://api.github.com/users/spicyj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spicyj/subscriptions","organizations_url":"https://api.github.com/users/spicyj/orgs","repos_url":"https://api.github.com/users/spicyj/repos","events_url":"https://api.github.com/users/spicyj/events{/privacy}","received_events_url":"https://api.github.com/users/spicyj/received_events","type":"User","site_admin":false},"created_at":"2016-09-12T18:48:48Z","updated_at":"2016-09-12T18:48:48Z","body":"@keyanzhang Sure. Maybe it could take both filenames just like `measure.py react.js,react-dom.js react2.js,react-dom2.js` or something. (Open to better ideas.)"}}
{"actor":{"display_login":"spicyj"}}