{"action":"opened","issue":{"url":"https://api.github.com/repos/fmir86/Jammming/issues/2","repository_url":"https://api.github.com/repos/fmir86/Jammming","labels_url":"https://api.github.com/repos/fmir86/Jammming/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/fmir86/Jammming/issues/2/comments","events_url":"https://api.github.com/repos/fmir86/Jammming/issues/2/events","html_url":"https://github.com/fmir86/Jammming/issues/2","id":301063377,"number":2,"title":"Fat Arrows","user":{"login":"farishkash","id":5844161,"avatar_url":"https://avatars2.githubusercontent.com/u/5844161?v=4","gravatar_id":"","url":"https://api.github.com/users/farishkash","html_url":"https://github.com/farishkash","followers_url":"https://api.github.com/users/farishkash/followers","following_url":"https://api.github.com/users/farishkash/following{/other_user}","gists_url":"https://api.github.com/users/farishkash/gists{/gist_id}","starred_url":"https://api.github.com/users/farishkash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/farishkash/subscriptions","organizations_url":"https://api.github.com/users/farishkash/orgs","repos_url":"https://api.github.com/users/farishkash/repos","events_url":"https://api.github.com/users/farishkash/events{/privacy}","received_events_url":"https://api.github.com/users/farishkash/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-28T15:17:44Z","updated_at":"2018-02-28T15:17:44Z","closed_at":null,"author_association":"NONE","body":"I made this a separate issue from the previous one.\r\n\r\nYou mentioned a more elegant solution and promises with fat arrows is a big part of that with es6.\r\nIt adds simplicity and clarity to what you are trying to write.  I only use them personally for callbacks and a promise that offers a built in callback.\r\n\r\nSome examples below.\r\n\r\nApp.js search\r\n\r\n```\r\nsearch(term) {\r\n    Spotify.search(term).then(searchResults => {\r\n      this.setState({searchResults: searchResults});\r\n    });\r\n  }\r\n```\r\n\r\nSpotify.js search\r\n\r\n```\r\nsearch(term) {\r\n    const accessToken = Spotify.getAccessToken();\r\n    return fetch(`https://api.spotify.com/v1/search?type=track&q=${term}`, {\r\n      headers: {\r\n        Authorization: `Bearer ${accessToken}`\r\n      }\r\n    }).then(response => {\r\n      return response.json();\r\n    }).then(jsonResponse => {\r\n      if (!jsonResponse.tracks) {\r\n        return [];\r\n      }\r\n      return jsonResponse.tracks.items.map(track => ({\r\n        id: track.id,\r\n        name: track.name,\r\n        artist: track.artists[0].name,\r\n        album: track.album.name,\r\n        uri: track.uri\r\n      }));\r\n    });\r\n  },\r\n```\r\n"}}
{"actor":{"display_login":"farishkash"}}