{"componentChunkName":"component---src-templates-blog-js","path":"/blog/2015/03/19/building-the-facebook-news-feed-with-relay.html","result":{"data":{"markdownRemark":{"html":"<p>At React.js Conf in January we gave a preview of Relay, a new framework for building data-driven applications in React. In this post, we’ll describe the process of creating a Relay application. This post assumes some familiarity with the concepts of Relay and GraphQL, so if you haven’t already we recommend reading <a href=\"/blog/2015/02/20/introducing-relay-and-graphql.html\">our introductory blog post</a> or watching <a href=\"https://www.youtube-nocookie.com/v/9sc8Pyc51uU\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">the conference talk</a>.</p>\n<p>We’re working hard to prepare GraphQL and Relay for public release. In the meantime, we’ll continue to provide information about what you can expect.</p>\n<br/>\n<h2 id=\"the-relay-architecture\"><a href=\"#the-relay-architecture\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>The Relay Architecture </h2>\n<p>The diagram below shows the main parts of the Relay architecture on the client and the server:</p>\n\n  <a class=\"gatsby-resp-image-link\" href=\"/static/1c7e934642028c84d5af545a945394ef/97a96/relay-architecture.png\" style=\"display: block\" target=\"_blank\" rel=\"noopener\">\n  \n  <span class=\"gatsby-resp-image-wrapper\" style=\"position: relative; display: block;  max-width: 840px; margin-left: auto; margin-right: auto;\">\n    <span class=\"gatsby-resp-image-background-image\" style=\"padding-bottom: 50%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAKCAIAAAA7N+mxAAAACXBIWXMAAAsSAAALEgHS3X78AAACHElEQVQozz2Sz2sTQRTH8yd4UawgiBbx90GPEluQZNOkm93Z2QQvUm+FIv44FUHqoQUptlqEJOJBQaVWJcXU1jQk2WxmdmNCbSI0xWhsmzRJk2w2Sf8DfZstwoc3j8e892XedyyC3BSSJppAevQSTFqY6gakdVD/j3lfbloQHFQT1BaSa5xU5eMVBFGquiI79i+/mK9/XKvbfGyXO6DGS3WB6OYIo1mU6+JKCS0WxNVdlKix4SJMGYlvjYbWRpe+j0SLiIBUA5OGl27heN5Lix5lDyU1C063HS9zx6/M9V2eO8u8cn7MDfpCg8F8YnLs79hFIDF12xYuDS2sucObAn3A0Xs8veOhBCX3LWKmw/jXj5x5cqh/+uRVPx8pI6niJO3l55P7D9nuOLP07JGTtvko1He86jQiE5hOeJU0SnaNZrtv/QTIWv391wJYqmNVhy24F3Pud8QbLtxQNFHVAU8KYoMN/0SJEqZNeK+pnD16fqbv0tNT1gAoC4qGEnvMp5xtPsNKVbSQYe5OOe4/do7PCrGKa7mIpBpMN5pxuuMIZI9dmD18bub0wIvh4Mb119JQ8AcXK7Mrv9loadgXstpFG3dzgLvlDuXZyDYsTyA9ZcOnSIV9u+l6k+feF3Cy6fy8ATvHCvisYbXtiZfxhww//80TzIpQUcD2poFhlWz4jFM6IKR0mIcVw0ZIejQQfJJU10DtmEXzk0DjP/UoaObD0JGsAAAAAElFTkSuQmCC&apos;); background-size: cover; display: block;\">\n      <img class=\"gatsby-resp-image-image\" style=\"width: 100%; height: 100%; margin: 0; vertical-align: middle; position: absolute; top: 0; left: 0; box-shadow: inset 0px 0px 0px 400px white;\" alt=\"Relay Architecture\" title src=\"/static/1c7e934642028c84d5af545a945394ef/1e088/relay-architecture.png\" srcset=\"/static/1c7e934642028c84d5af545a945394ef/65ed1/relay-architecture.png 210w,\n/static/1c7e934642028c84d5af545a945394ef/d10fb/relay-architecture.png 420w,\n/static/1c7e934642028c84d5af545a945394ef/1e088/relay-architecture.png 840w,\n/static/1c7e934642028c84d5af545a945394ef/78612/relay-architecture.png 1260w,\n/static/1c7e934642028c84d5af545a945394ef/21cdd/relay-architecture.png 1680w,\n/static/1c7e934642028c84d5af545a945394ef/97a96/relay-architecture.png 2400w\" sizes=\"(max-width: 840px) 100vw, 840px\">\n    </span>\n  </span>\n  \n  </a>\n    \n<p>The main pieces are as follows:</p>\n<ul>\n<li>Relay Components: React components annotated with declarative data descriptions.</li>\n<li>Actions: Descriptions of how data should change in response to user actions.</li>\n<li>Relay Store: A client-side data store that is fully managed by the framework.</li>\n<li>Server: An HTTP server with GraphQL endpoints (one for reads, one for writes) that respond to GraphQL queries.</li>\n</ul>\n<p>This post will focus on <strong>Relay components</strong> that describe encapsulated units of UI and their data dependencies. These components form the majority of a Relay application.</p>\n<br/>\n<h2 id=\"a-relay-application\"><a href=\"#a-relay-application\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>A Relay Application </h2>\n<p>To see how components work and can be composed, let’s implement a basic version of the Facebook News Feed in Relay. Our application will have two components: a <code class=\"gatsby-code-text\">&lt;NewsFeed&gt;</code> that renders a list of <code class=\"gatsby-code-text\">&lt;Story&gt;</code> items. We’ll introduce the plain React version of each component first and then convert it to a Relay component. The goal is something like the following:</p>\n\n  <a class=\"gatsby-resp-image-link\" href=\"/static/75bc0f3653210df5df2c21a706cab9eb/37523/sample-newsfeed.png\" style=\"display: block\" target=\"_blank\" rel=\"noopener\">\n  \n  <span class=\"gatsby-resp-image-wrapper\" style=\"position: relative; display: block;  max-width: 720px; margin-left: auto; margin-right: auto;\">\n    <span class=\"gatsby-resp-image-background-image\" style=\"padding-bottom: 125.23809523809524%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAZCAIAAAC+dZmEAAAACXBIWXMAAAsSAAALEgHS3X78AAADbElEQVQ4y3VU21LaUBTlD9ov6JPjb7TWtz7UPln9AOmM9Sf61q+oT7YO1tEZEbkT5KaIXJWAIIRwS0KAIEiAIHQlJ421o0vc7HM4l73X2vuYer3edDqdz+eKooxGI1mWYUfj8Yg4L2A8Ht/d3ZmmitLkOJvXX2KY4XA4GNz3+338MNQgvwBsxhEm3GlzeV6/+7i9u5eMX+78/EX5qL09y8HhYbF4i3U4qP8PBhpIgCbEXGaYH7u/s3QOofI83+122+22ILR6Pf3+exXERWgDEpe6Gf8YCFyzVCpVNNSqtUa9zjCMNmKLxSLLshjCwZwoiliPw9TN4KnRqHt9VDx+CUQiEdjzM+A8FovhCzORsDp5cXEROTvrdDqIWb95om5u+ClfLHaJD03TyWQK6+KJRDKRCIXC+AsFQzgolUoFAoF0OsPzAtHFNJlMEGRARTCVTp9HozgiHArikkQy2Wq1BEEQxXZLhagOBKHblR5zRuRTZXKvsniPfKC8ajWSlQkig/kLRSHlAFfPGTqfUKfghyQDMgb9ASmG4XPAgic6v3r7VGeL5eDgeZ0J/tW5sm3Zv6ZporMkdSVJgiRYhPCMqjKKF3frOSOAniSx5TLEzOdzt8VbhilnMhnQns/nIR/sbbEIm81mbwqFq6urcpnR2UbOtVrt5MTu8Xjsdrvb7fFTftRDqVyq1+uoHBwKB3LCqVarFYZpNjl9sxaGjAgRqqqG2OY4DlERSgjVYw3EITwTmMgZbVEEifOnwE75ucbEpC4VFjl81JsPn3f2D67TqaMjK0rSaj1yOJwVTTzSSUY/EV8nbD6bJdKZL9++U6Gw2GqhqsBZjqazWRqNJY/kx4bSSCZDXSo8CqipDs8JPIeMkXkbObRFNIDA88gfmsGCVBQmz/GYrLAsihCckMaoB4Mht9vtcrkon89PUQge/J+enlIUhXmv13tstUIO27EtEY/TdA4HIW21MUSxVS7hRahAoUKhAB/H4WcIhFehyrLwq7XaDcogl4NmhC1dKnA2m80MC8FwCS50Op1QnvjYTxYAePZgdamMWUV7RrFhcXFxaWnp08rK6urq8vL7hYUFh8NBxDOE1MvTGD88PMBGo9H19fUN88bm5ubXrS2z2by2toZJYwEBNprQNKSYDEAJKImuljTAMYT9793+A3VmMrVlnD05AAAAAElFTkSuQmCC&apos;); background-size: cover; display: block;\">\n      <img class=\"gatsby-resp-image-image\" style=\"width: 100%; height: 100%; margin: 0; vertical-align: middle; position: absolute; top: 0; left: 0; box-shadow: inset 0px 0px 0px 400px white;\" alt=\"Sample News Feed\" title src=\"/static/75bc0f3653210df5df2c21a706cab9eb/37523/sample-newsfeed.png\" srcset=\"/static/75bc0f3653210df5df2c21a706cab9eb/65ed1/sample-newsfeed.png 210w,\n/static/75bc0f3653210df5df2c21a706cab9eb/d10fb/sample-newsfeed.png 420w,\n/static/75bc0f3653210df5df2c21a706cab9eb/37523/sample-newsfeed.png 720w\" sizes=\"(max-width: 720px) 100vw, 720px\">\n    </span>\n  </span>\n  \n  </a>\n    \n<br/>\n<h2 id=\"the-story-begins\"><a href=\"#the-story-begins\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>The <code class=\"gatsby-code-text\">&lt;Story&gt;</code> Begins </h2>\n<p>The first step is a React <code class=\"gatsby-code-text\">&lt;Story&gt;</code> component that accepts a <code class=\"gatsby-code-text\">story</code> prop with the story’s text and author information. Note that all examples uses ES6 syntax and elide presentation details to focus on the pattern of data access.</p>\n<div class=\"gatsby-highlight\" data-language=\"jsx\"><pre class=\"gatsby-code-jsx\"><code class=\"gatsby-code-jsx\"><span class=\"token comment\">// Story.react.js</span>\n<span class=\"token keyword\">export</span> <span class=\"token keyword\">default</span> <span class=\"token keyword\">class</span> <span class=\"token class-name\">Story</span> <span class=\"token keyword\">extends</span> <span class=\"token class-name\">React<span class=\"token punctuation\">.</span>Component</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token function\">render</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">var</span> story <span class=\"token operator\">=</span> <span class=\"token keyword\">this</span><span class=\"token punctuation\">.</span>props<span class=\"token punctuation\">.</span>story<span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">return</span> <span class=\"token punctuation\">(</span>\n      <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span><span class=\"token class-name\">View</span></span><span class=\"token punctuation\">></span></span><span class=\"token plain-text\">\n        </span><span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span><span class=\"token class-name\">Image</span></span> <span class=\"token attr-name\">uri</span><span class=\"token script language-javascript\"><span class=\"token script-punctuation punctuation\">=</span><span class=\"token punctuation\">{</span>story<span class=\"token punctuation\">.</span>author<span class=\"token punctuation\">.</span>profilePicture<span class=\"token punctuation\">.</span>uri<span class=\"token punctuation\">}</span></span> <span class=\"token punctuation\">/></span></span><span class=\"token plain-text\">\n        </span><span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span><span class=\"token class-name\">Text</span></span><span class=\"token punctuation\">></span></span><span class=\"token punctuation\">{</span>story<span class=\"token punctuation\">.</span>author<span class=\"token punctuation\">.</span>name<span class=\"token punctuation\">}</span><span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span><span class=\"token class-name\">Text</span></span><span class=\"token punctuation\">></span></span><span class=\"token plain-text\">\n        </span><span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span><span class=\"token class-name\">Text</span></span><span class=\"token punctuation\">></span></span><span class=\"token punctuation\">{</span>story<span class=\"token punctuation\">.</span>text<span class=\"token punctuation\">}</span><span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span><span class=\"token class-name\">Text</span></span><span class=\"token punctuation\">></span></span><span class=\"token plain-text\">\n      </span><span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span><span class=\"token class-name\">View</span></span><span class=\"token punctuation\">></span></span>\n    <span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n  <span class=\"token punctuation\">}</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<br/>\n<h2 id=\"whats-the-story\"><a href=\"#whats-the-story\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What’s the <code class=\"gatsby-code-text\">&lt;Story&gt;</code>? </h2>\n<p>Relay automates the process of fetching data for components by wrapping existing React components in Relay containers (themselves React components):</p>\n<div class=\"gatsby-highlight\" data-language=\"jsx\"><pre class=\"gatsby-code-jsx\"><code class=\"gatsby-code-jsx\"><span class=\"token comment\">// Story.react.js</span>\n<span class=\"token keyword\">class</span> <span class=\"token class-name\">Story</span> <span class=\"token keyword\">extends</span> <span class=\"token class-name\">React<span class=\"token punctuation\">.</span>Component</span> <span class=\"token punctuation\">{</span> <span class=\"token operator\">...</span> <span class=\"token punctuation\">}</span>\n\n<span class=\"token keyword\">export</span> <span class=\"token keyword\">default</span> Relay<span class=\"token punctuation\">.</span><span class=\"token function\">createContainer</span><span class=\"token punctuation\">(</span>Story<span class=\"token punctuation\">,</span> <span class=\"token punctuation\">{</span>\n  fragments<span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n    story<span class=\"token operator\">:</span> <span class=\"token comment\">/* TODO */</span>\n  <span class=\"token punctuation\">}</span>\n<span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></code></pre></div>\n<p>Before adding the GraphQL fragment, let’s look at the component hierarchy this creates:</p>\n\n  <a class=\"gatsby-resp-image-link\" href=\"/static/4e4a71a85b278968b8719601692bc18c/65c7b/relay-containers.png\" style=\"display: block\" target=\"_blank\" rel=\"noopener\">\n  \n  <span class=\"gatsby-resp-image-wrapper\" style=\"position: relative; display: block;  max-width: 795px; margin-left: auto; margin-right: auto;\">\n    <span class=\"gatsby-resp-image-background-image\" style=\"padding-bottom: 132.85714285714286%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAbCAIAAADzvTiPAAAACXBIWXMAAAsSAAALEgHS3X78AAAD2UlEQVQ4y5WT/U8TdxzH+88sG0MotIA8tNde27sW7q4PV67HM/SJtrRANjMnOAY6HUtkqYzJDOwBmOAyf1Ww1rbXgz4oDzJkLss2l8CkV42YDch+3aewERSqM3nl8v58P+93Pp/vJV+RKSzQXPogJi5NhDOQkTQR+Vcbn/dkiKRFJk6g+fQeZj5t4B83839MxFe+Ta6Ox1cmEvdBTCbv26Jr0DL/58zAHQpT/BM3v/b7vflfl+4mgzPxwPVflu6uryx0RB+SmbCQNQwY+ccN/CP/3AN//OeByA8XwssgBmM/NUfXYTL9wmSaE0xRwcil9tFzKTwsaLkn6hu/qacfgsBCcPicByJ0FCZHBCaxWb+4U7+4vU/j4lbT8t+1/EbNbAoElAe7DUs7lsQmrCwyxZ5ZxiPatl688zzecQ7A2j9CPb1oW5/c2Y04u1HvGaWnDw73unjnx5i7h/k6aE78KaLvbBkuTOZL0bwKMr+8Kresshg1tp/o9b37gavz9Dunzjq87zt8J4+rTbmllXnlVfky6u0ChOofsyzsiOjkX8aL14qUBqm2VoqzEsxSSjRU1nqopnZjSyfZ6CMb20GXEQ3QAoNUV1soJ40DU8z89m7Y/70UoSQYK9EwUg2Tj9I5MuqtCurNchK+u4LKV9LQAoMEZwsqqmBZywvhIsxyDDG63+sbGbs6NDox/NWV4S+vDI2Oj05819F1LhcxgCFruBhnYdrg5W9Sj9ZWV1dmeY6Pcg9+XBU21kfGp94oI4q1bPbJOJsj0/f0X4zysRs3g9enA8B04DY/Gzv/6SXYHwxZw5krYczxqjqZvrGMqMdZJ8Y6y4hMWUrUQetld4a2WG4+VmLMLTHmSPUlihogp0gPJRyK5XQmf3QYZwuV1Uq7Fe9pxbqd6lN26qyPOuMDgXU54RB1WsEg1dYcFdaxBeVmctirW/ZoYq1YwqWKO9XxjIBSu+whR7ySCkaqOzKshX3MWr9bMWuXBVoUQZsm1Kq67UCCVlnAiszZ8CG3RMZkZmQL6wbdqrhDdquZiPpOLvs7FvrJqE92qwWNO7Sf/4+wMmaXB1uQkFUZsqNhhyJkg1IRt706THzm1SU9mnArxrk0XCsAAgu7tHc8xCXvbrgmy99WVctrm1RtdtRlQ90HcNlUXru8rrkQPfy3918VDFcxYoQRKw6BMNACw96rMgxM7YW34H0VFKvFcr1YRhbIX0bGgBjyJEr9J2OW+R2RaXaTvRrXnx6iei9TH37xasDWNWiZnDPHnonoqGBOPmUWtl6H7erEU5oXRIbplOFmSj+z8VpAxDAj/APa5w77Mo46oAAAAABJRU5ErkJggg==&apos;); background-size: cover; display: block;\">\n      <img class=\"gatsby-resp-image-image\" style=\"width: 100%; height: 100%; margin: 0; vertical-align: middle; position: absolute; top: 0; left: 0; box-shadow: inset 0px 0px 0px 400px white;\" alt=\"React Container Data Flow\" title src=\"/static/4e4a71a85b278968b8719601692bc18c/65c7b/relay-containers.png\" srcset=\"/static/4e4a71a85b278968b8719601692bc18c/65ed1/relay-containers.png 210w,\n/static/4e4a71a85b278968b8719601692bc18c/d10fb/relay-containers.png 420w,\n/static/4e4a71a85b278968b8719601692bc18c/65c7b/relay-containers.png 795w\" sizes=\"(max-width: 795px) 100vw, 795px\">\n    </span>\n  </span>\n  \n  </a>\n    \n<p>Most props will be passed through from the container to the original component. However, Relay will return the query results for a prop whenever a fragment is defined. In this case we’ll add a GraphQL fragment for <code class=\"gatsby-code-text\">story</code>:</p>\n<div class=\"gatsby-highlight\" data-language=\"jsx\"><pre class=\"gatsby-code-jsx\"><code class=\"gatsby-code-jsx\"><span class=\"token comment\">// Story.react.js</span>\n<span class=\"token keyword\">class</span> <span class=\"token class-name\">Story</span> <span class=\"token keyword\">extends</span> <span class=\"token class-name\">React<span class=\"token punctuation\">.</span>Component</span> <span class=\"token punctuation\">{</span> <span class=\"token operator\">...</span> <span class=\"token punctuation\">}</span>\n\n<span class=\"token keyword\">export</span> <span class=\"token keyword\">default</span> Relay<span class=\"token punctuation\">.</span><span class=\"token function\">createContainer</span><span class=\"token punctuation\">(</span>Story<span class=\"token punctuation\">,</span> <span class=\"token punctuation\">{</span>\n  fragments<span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token function-variable function\">story</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> Relay<span class=\"token punctuation\">.</span><span class=\"token constant\">QL</span><span class=\"token template-string\"><span class=\"token template-punctuation string\">`</span><span class=\"token string\">\n      fragment on Story {\n        author {\n          name\n          profilePicture {\n            uri\n          }\n        }\n        text\n      }\n    </span><span class=\"token template-punctuation string\">`</span></span><span class=\"token punctuation\">,</span>\n  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n<span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></code></pre></div>\n<p>Queries use ES6 template literals tagged with the <code class=\"gatsby-code-text\">Relay.QL</code> function. Similar to how JSX transpiles to plain JavaScript objects and function calls, these template literals transpile to plain objects that describe fragments. Note that the fragment’s structure closely matches the object structure that we expected in <code class=\"gatsby-code-text\">&lt;Story&gt;</code>’s render function.</p>\n<br/>\n<h2 id=\"storys-on-demand\"><a href=\"#storys-on-demand\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><code class=\"gatsby-code-text\">&lt;Story&gt;</code>s on Demand </h2>\n<p>We can render a Relay component by providing Relay with the component (<code class=\"gatsby-code-text\">&lt;Story&gt;</code>) and the ID of the data (a story ID). Given this information, Relay will first fetch the results of the query and then <code class=\"gatsby-code-text\">render()</code> the component. The value of <code class=\"gatsby-code-text\">props.story</code> will be a plain JavaScript object such as the following:</p>\n<div class=\"gatsby-highlight\" data-language=\"jsx\"><pre class=\"gatsby-code-jsx\"><code class=\"gatsby-code-jsx\"><span class=\"token punctuation\">{</span>\n  author<span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n    name<span class=\"token operator\">:</span> <span class=\"token string\">\"Greg\"</span><span class=\"token punctuation\">,</span>\n    profilePicture<span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n      uri<span class=\"token operator\">:</span> <span class=\"token string\">\"https://…\"</span>\n    <span class=\"token punctuation\">}</span>\n  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n  text<span class=\"token operator\">:</span> <span class=\"token string\">\"The first Relay blog post is up…\"</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<p>Relay guarantees that all data required to render a component will be available before it is rendered. This means that <code class=\"gatsby-code-text\">&lt;Story&gt;</code> does not need to handle a loading state; the <code class=\"gatsby-code-text\">story</code> is <em>guaranteed</em> to be available before <code class=\"gatsby-code-text\">render()</code> is called. We have found that this invariant simplifies our application code <em>and</em> improves the user experience. Of course, Relay also has options to delay the fetching of some parts of our queries.</p>\n<p>The diagram below shows how Relay containers make data available to our React components:</p>\n\n  <a class=\"gatsby-resp-image-link\" href=\"/static/46e660a80043eb9e7a4ea27b3562d4a7/99375/relay-containers-data-flow.png\" style=\"display: block\" target=\"_blank\" rel=\"noopener\">\n  \n  <span class=\"gatsby-resp-image-wrapper\" style=\"position: relative; display: block;  max-width: 840px; margin-left: auto; margin-right: auto;\">\n    <span class=\"gatsby-resp-image-background-image\" style=\"padding-bottom: 69.04761904761905%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAOCAIAAACgpqunAAAACXBIWXMAAAsSAAALEgHS3X78AAACnklEQVQoz2MIPPAy+OBL/4Ov0g4+rjt4q/bg7bKDd4MOviQGMQQefBl86IXXodd1R+5sOXBk04Gjiw6fDzj0KvDQyyB09AIVvWQIOvQq7Pg7IAo99jbo4IuAvY9Djr0FsoEiIUffAEWg6NBL3+MffU58hiDfYx/Amjdccclrcchu9C7tDq2bHFozwb+y3ymvxTGj1m/KhpATH4KPvA468ibi0POdvZXn6mJPNKVdqI1eN7kt8OhbhsDlJ4zs/XStvU2dgpz8Yh19Y6zdw/VsfXVNXVwrJgTse+yx4pTH+itRu+8+zzD+H8D6J4Tvvx/zjWLPwGPvGQJXnDZzj9RzDC6q75gxf/GU2Qv7Z8xzDEnWs/Z1q5kaePC53467vrseRuy68yTH5n+i0s9qr/+RYlcrgiCaT5m6hevYB1a29CxZtWbxyjWzFi51DE7StfJyq5oUdOSV97oL3tvuRO178DjP/n+C0o9K9//RElcqQ6CaTVzDjF3DDN1Cjd3DzLwi9JyDTDwiDGx93aonBx99G7jnod/+Z9H7Hj7PMv0fxPEnVBDo+BulXmDNK08ZO4Zax8S6rklzXpPqsjrVZWOqU3OqgYWPW920kJMfQVFw+HXkoWenm1MfF7ncqfB7Vui4r7sk8Og7sGaHEJukOLsjib4ncsNOltieSnCclGJg7utWNxUY2kBvQ+LZ9+gHn2MfIcj36HtQVAWuOm3iHG6TEO+yNcNlS7rr5gznXenOnemGVn7u9dOBmoNgmjERQ+Cyk0Z2/ob2/maewaaeQUBk5hVs4hasa+rqWjkp5MTHwAPPcSbP4I2XnbPqHDJq7NOq4cghs9Yhpdxv0pqQk++CD78IPvISK2Lw3/kycO/bICDah4KAggG7X/vvfIEHAQCsOs+KYXEcGAAAAABJRU5ErkJggg==&apos;); background-size: cover; display: block;\">\n      <img class=\"gatsby-resp-image-image\" style=\"width: 100%; height: 100%; margin: 0; vertical-align: middle; position: absolute; top: 0; left: 0; box-shadow: inset 0px 0px 0px 400px white;\" alt=\"Relay Container Data Flow\" title src=\"/static/46e660a80043eb9e7a4ea27b3562d4a7/1e088/relay-containers-data-flow.png\" srcset=\"/static/46e660a80043eb9e7a4ea27b3562d4a7/65ed1/relay-containers-data-flow.png 210w,\n/static/46e660a80043eb9e7a4ea27b3562d4a7/d10fb/relay-containers-data-flow.png 420w,\n/static/46e660a80043eb9e7a4ea27b3562d4a7/1e088/relay-containers-data-flow.png 840w,\n/static/46e660a80043eb9e7a4ea27b3562d4a7/78612/relay-containers-data-flow.png 1260w,\n/static/46e660a80043eb9e7a4ea27b3562d4a7/99375/relay-containers-data-flow.png 1525w\" sizes=\"(max-width: 840px) 100vw, 840px\">\n    </span>\n  </span>\n  \n  </a>\n    \n<br/>\n<h2 id=\"newsfeed-worthy\"><a href=\"#newsfeed-worthy\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><code class=\"gatsby-code-text\">&lt;NewsFeed&gt;</code> Worthy </h2>\n<p>Now that the <code class=\"gatsby-code-text\">&lt;Story&gt;</code> is over we can continue with the <code class=\"gatsby-code-text\">&lt;NewsFeed&gt;</code> component. Again, we’ll start with a React version:</p>\n<div class=\"gatsby-highlight\" data-language=\"jsx\"><pre class=\"gatsby-code-jsx\"><code class=\"gatsby-code-jsx\"><span class=\"token comment\">// NewsFeed.react.js</span>\n<span class=\"token keyword\">class</span> <span class=\"token class-name\">NewsFeed</span> <span class=\"token keyword\">extends</span> <span class=\"token class-name\">React<span class=\"token punctuation\">.</span>Component</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token function\">render</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">var</span> stories <span class=\"token operator\">=</span> <span class=\"token keyword\">this</span><span class=\"token punctuation\">.</span>props<span class=\"token punctuation\">.</span>viewer<span class=\"token punctuation\">.</span>stories<span class=\"token punctuation\">;</span> <span class=\"token comment\">// `viewer` is the active user</span>\n    <span class=\"token keyword\">return</span> <span class=\"token punctuation\">(</span>\n      <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span><span class=\"token class-name\">View</span></span><span class=\"token punctuation\">></span></span><span class=\"token plain-text\">\n        </span><span class=\"token punctuation\">{</span>stories<span class=\"token punctuation\">.</span><span class=\"token function\">map</span><span class=\"token punctuation\">(</span><span class=\"token parameter\">story</span> <span class=\"token operator\">=></span> <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span><span class=\"token class-name\">Story</span></span> <span class=\"token attr-name\">story</span><span class=\"token script language-javascript\"><span class=\"token script-punctuation punctuation\">=</span><span class=\"token punctuation\">{</span>story<span class=\"token punctuation\">}</span></span> <span class=\"token punctuation\">/></span></span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">}</span><span class=\"token plain-text\">\n        </span><span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span><span class=\"token class-name\">Button</span></span> <span class=\"token attr-name\">onClick</span><span class=\"token script language-javascript\"><span class=\"token script-punctuation punctuation\">=</span><span class=\"token punctuation\">{</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token keyword\">this</span><span class=\"token punctuation\">.</span><span class=\"token function\">loadMore</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">}</span></span><span class=\"token punctuation\">></span></span><span class=\"token plain-text\">Load More</span><span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span><span class=\"token class-name\">Button</span></span><span class=\"token punctuation\">></span></span><span class=\"token plain-text\">\n      </span><span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span><span class=\"token class-name\">View</span></span><span class=\"token punctuation\">></span></span>\n    <span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n  <span class=\"token punctuation\">}</span>\n\n  <span class=\"token function\">loadMore</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token comment\">// TODO: fetch more stories</span>\n  <span class=\"token punctuation\">}</span>\n<span class=\"token punctuation\">}</span>\n\nmodule<span class=\"token punctuation\">.</span>exports <span class=\"token operator\">=</span> NewsFeed<span class=\"token punctuation\">;</span></code></pre></div>\n<br/>\n<h2 id=\"all-the-news-fit-to-be-relayed\"><a href=\"#all-the-news-fit-to-be-relayed\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>All the News Fit to be Relayed </h2>\n<p><code class=\"gatsby-code-text\">&lt;NewsFeed&gt;</code> has two new requirements: it composes <code class=\"gatsby-code-text\">&lt;Story&gt;</code> and requests more data at runtime.</p>\n<p>Just as React views can be nested, Relay components can compose query fragments from child components. Composition in GraphQL uses ES6 template literal substitution: <code class=\"gatsby-code-text\">${Component.getFragment(&#39;prop&#39;)}</code>. Pagination can be accomplished with a variable, specified with <code class=\"gatsby-code-text\">$variable</code> (as in <code class=\"gatsby-code-text\">stories(first: $count)</code>):</p>\n<div class=\"gatsby-highlight\" data-language=\"jsx\"><pre class=\"gatsby-code-jsx\"><code class=\"gatsby-code-jsx\"><span class=\"token comment\">// NewsFeed.react.js</span>\n<span class=\"token keyword\">class</span> <span class=\"token class-name\">NewsFeed</span> <span class=\"token keyword\">extends</span> <span class=\"token class-name\">React<span class=\"token punctuation\">.</span>Component</span> <span class=\"token punctuation\">{</span> <span class=\"token operator\">...</span> <span class=\"token punctuation\">}</span>\n\n<span class=\"token keyword\">export</span> <span class=\"token keyword\">default</span> Relay<span class=\"token punctuation\">.</span><span class=\"token function\">createContainer</span><span class=\"token punctuation\">(</span>NewsFeed<span class=\"token punctuation\">,</span> <span class=\"token punctuation\">{</span>\n  initialVariables<span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n    count<span class=\"token operator\">:</span> <span class=\"token number\">3</span>                                <span class=\"token comment\">/* default to 3 stories */</span>\n  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n  fragments<span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token function-variable function\">viewer</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> Relay<span class=\"token punctuation\">.</span><span class=\"token constant\">QL</span><span class=\"token template-string\"><span class=\"token template-punctuation string\">`</span><span class=\"token string\">\n      fragment on Viewer {\n        stories(first: $count) {            /* fetch viewer's stories */\n          edges {                           /* traverse the graph */\n            node {\n              </span><span class=\"token interpolation\"><span class=\"token interpolation-punctuation punctuation\">${</span>Story<span class=\"token punctuation\">.</span><span class=\"token function\">getFragment</span><span class=\"token punctuation\">(</span><span class=\"token string\">'story'</span><span class=\"token punctuation\">)</span><span class=\"token interpolation-punctuation punctuation\">}</span></span><span class=\"token string\"> /* compose child fragment */\n            }\n          }\n        }\n      }\n    </span><span class=\"token template-punctuation string\">`</span></span><span class=\"token punctuation\">,</span>\n  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n<span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></code></pre></div>\n<p>Whenever <code class=\"gatsby-code-text\">&lt;NewsFeed&gt;</code> is rendered, Relay will recursively expand all the composed fragments and fetch the queries in a single trip to the server. In this case, the <code class=\"gatsby-code-text\">text</code> and <code class=\"gatsby-code-text\">author</code> data will be fetched for each of the 3 story nodes.</p>\n<p>Query variables are available to components as <code class=\"gatsby-code-text\">props.relay.variables</code> and can be modified with <code class=\"gatsby-code-text\">props.relay.setVariables(nextVariables)</code>. We can use these to implement pagination:</p>\n<div class=\"gatsby-highlight\" data-language=\"jsx\"><pre class=\"gatsby-code-jsx\"><code class=\"gatsby-code-jsx\"><span class=\"token comment\">// NewsFeed.react.js</span>\n<span class=\"token keyword\">class</span> <span class=\"token class-name\">NewsFeed</span> <span class=\"token keyword\">extends</span> <span class=\"token class-name\">React<span class=\"token punctuation\">.</span>Component</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token function\">render</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span> <span class=\"token operator\">...</span> <span class=\"token punctuation\">}</span>\n\n  <span class=\"token function\">loadMore</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token comment\">// read current params</span>\n    <span class=\"token keyword\">var</span> count <span class=\"token operator\">=</span> <span class=\"token keyword\">this</span><span class=\"token punctuation\">.</span>props<span class=\"token punctuation\">.</span>relay<span class=\"token punctuation\">.</span>variables<span class=\"token punctuation\">.</span>count<span class=\"token punctuation\">;</span>\n    <span class=\"token comment\">// update params</span>\n    <span class=\"token keyword\">this</span><span class=\"token punctuation\">.</span>props<span class=\"token punctuation\">.</span>relay<span class=\"token punctuation\">.</span><span class=\"token function\">setVariables</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">{</span>\n      count<span class=\"token operator\">:</span> count <span class=\"token operator\">+</span> <span class=\"token number\">5</span><span class=\"token punctuation\">,</span>\n    <span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n  <span class=\"token punctuation\">}</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<p>Now when <code class=\"gatsby-code-text\">loadMore()</code> is called, Relay will send a GraphQL request for the additional five stories. When these stories are fetched, the component will re-render with the new stories available in <code class=\"gatsby-code-text\">props.viewer.stories</code> and the updated count reflected in <code class=\"gatsby-code-text\">props.relay.variables.count</code>.</p>\n<br/>\n<h2 id=\"in-conclusion\"><a href=\"#in-conclusion\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>In Conclusion </h2>\n<p>These two components form a solid core for our application. With the use of Relay containers and GraphQL queries, we’ve enabled the following benefits:</p>\n<ul>\n<li>Automatic and efficient pre-fetching of data for an entire view hierarchy in a single network request.</li>\n<li>Trivial pagination with automatic optimizations to fetch only the additional items.</li>\n<li>View composition and reusability, so that <code class=\"gatsby-code-text\">&lt;Story&gt;</code> can be used on its own or within <code class=\"gatsby-code-text\">&lt;NewsFeed&gt;</code>, without any changes to either component.</li>\n<li>Automatic subscriptions, so that components will re-render if their data changes. Unaffected components will not re-render unnecessarily.</li>\n<li>Exactly <em>zero</em> lines of imperative data fetching logic. Relay takes full advantage of React’s declarative component model.</li>\n</ul>\n<p>But Relay has many more tricks up its sleeve. For example, it’s built from the start to handle reads and writes, allowing for features like optimistic client updates with transactional rollback. Relay can also defer fetching select parts of queries, and it uses a local data store to avoid fetching the same data twice. These are all powerful features that we hope to explore in future posts.</p>","excerpt":"At React.js Conf in January we gave a preview of Relay, a new framework for building data-driven applications in React. In this post, we’ll describe the process of creating a Relay application. This post assumes some familiarity with the concepts of Relay and GraphQL, so if you haven’t already we recommend reading our introductory blog post or watching the conference talk. We’re working hard to prepare GraphQL and Relay for public release. In the meantime, we’ll continue to provide information…","frontmatter":{"title":"Building The Facebook News Feed With Relay","next":null,"prev":null,"author":[{"frontmatter":{"name":"Joseph Savona","url":"https://twitter.com/en_JS"}}]},"fields":{"date":"March 19, 2015","path":"content/blog/2015-03-19-building-the-facebook-news-feed-with-relay.md","slug":"/blog/2015/03/19/building-the-facebook-news-feed-with-relay.html"}},"allMarkdownRemark":{"edges":[{"node":{"frontmatter":{"title":"Introducing the New JSX Transform"},"fields":{"slug":"/blog/2020/09/22/introducing-the-new-jsx-transform.html"}}},{"node":{"frontmatter":{"title":"React v17.0 Release Candidate: No New Features"},"fields":{"slug":"/blog/2020/08/10/react-v17-rc.html"}}},{"node":{"frontmatter":{"title":"React v16.13.0"},"fields":{"slug":"/blog/2020/02/26/react-v16.13.0.html"}}},{"node":{"frontmatter":{"title":"Building Great User Experiences with Concurrent Mode and Suspense"},"fields":{"slug":"/blog/2019/11/06/building-great-user-experiences-with-concurrent-mode-and-suspense.html"}}},{"node":{"frontmatter":{"title":"Preparing for the Future with React Prereleases"},"fields":{"slug":"/blog/2019/10/22/react-release-channels.html"}}},{"node":{"frontmatter":{"title":"Introducing the New React DevTools"},"fields":{"slug":"/blog/2019/08/15/new-react-devtools.html"}}},{"node":{"frontmatter":{"title":"React v16.9.0 and the Roadmap Update"},"fields":{"slug":"/blog/2019/08/08/react-v16.9.0.html"}}},{"node":{"frontmatter":{"title":"Is React Translated Yet? ¡Sí! Sim! はい！"},"fields":{"slug":"/blog/2019/02/23/is-react-translated-yet.html"}}},{"node":{"frontmatter":{"title":"React v16.8: The One With Hooks"},"fields":{"slug":"/blog/2019/02/06/react-v16.8.0.html"}}},{"node":{"frontmatter":{"title":"React v16.7: No, This Is Not the One With Hooks"},"fields":{"slug":"/blog/2018/12/19/react-v-16-7.html"}}}]}},"pageContext":{"slug":"/blog/2015/03/19/building-the-facebook-news-feed-with-relay.html"}},"staticQueryHashes":[]}