{"action":"opened","issue":{"url":"https://api.github.com/repos/atom/github/issues/1403","repository_url":"https://api.github.com/repos/atom/github","labels_url":"https://api.github.com/repos/atom/github/issues/1403/labels{/name}","comments_url":"https://api.github.com/repos/atom/github/issues/1403/comments","events_url":"https://api.github.com/repos/atom/github/issues/1403/events","html_url":"https://github.com/atom/github/issues/1403","id":316106041,"number":1403,"title":"Ref soup","user":{"login":"smashwilson","id":17565,"avatar_url":"https://avatars2.githubusercontent.com/u/17565?v=4","gravatar_id":"","url":"https://api.github.com/users/smashwilson","html_url":"https://github.com/smashwilson","followers_url":"https://api.github.com/users/smashwilson/followers","following_url":"https://api.github.com/users/smashwilson/following{/other_user}","gists_url":"https://api.github.com/users/smashwilson/gists{/gist_id}","starred_url":"https://api.github.com/users/smashwilson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smashwilson/subscriptions","organizations_url":"https://api.github.com/users/smashwilson/orgs","repos_url":"https://api.github.com/users/smashwilson/repos","events_url":"https://api.github.com/users/smashwilson/events{/privacy}","received_events_url":"https://api.github.com/users/smashwilson/received_events","type":"User","site_admin":true},"labels":[{"id":750529784,"url":"https://api.github.com/repos/atom/github/labels/code-cleanup%20:wrench:","name":"code-cleanup :wrench:","color":"bde56e","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-20T02:36:17Z","updated_at":"2018-04-20T02:36:17Z","closed_at":null,"author_association":"OWNER","body":"We use a lot of refs in our JSX, which feels un-React-y.\r\n\r\nThere are a number of reasons for this:\r\n\r\n1. The package used to use [Etch](https://github.com/atom/etch) exclusively. Etch makes it much easier to operate imperatively on `this.element`. As different components were ported to React, it was often more convenient to use refs to defer re-architecting the way that some things were written.\r\n2. Before we adopted Enzyme, refs were the most convenient way to access children within test cases. Some tests are still written in the \"descending through a ref tree\" style to access things they need to.\r\n3. We provide a number of components to declaratively interact with the Atom API (`Decoration`, `Command`, `PaneItem`). The Atom API accepts DOM elements as \"items,\" so often we need to use a ref to pass one.\r\n4. We have a (fairly clunky) mechanism to manage preserving focus as tabs as hidden and shown. Because focus is an imperative DOM API, we need refs to test for and operate on element focus.\r\n\r\nRefs that exist from categories (1) and (2) should be relatively easy to eliminate. I suspect, but have not confirmed, that we could tidy up quite a few of them.\r\n\r\nI suspect that we can do better on (3) and (4) as well with alternate designs... but I'm not sure what those might look like. Brainstorming is welcome :smile:"}}
{"actor":{"display_login":"smashwilson"}}