{"componentChunkName":"component---src-templates-blog-js","path":"/blog/2016/09/28/our-first-50000-stars.html","result":{"data":{"markdownRemark":{"html":"<p>Just three and a half years ago we open sourced a little JavaScript library called React. The journey since that day has been incredibly exciting.</p>\n<h2 id=\"commemorative-t-shirt\"><a href=\"#commemorative-t-shirt\" 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>Commemorative T-Shirt </h2>\n<p>In order to celebrate 50,000 GitHub stars, <a href=\"http://www.maggieappleton.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Maggie Appleton</a> from <a href=\"http://egghead.io/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">egghead.io</a> has designed us a special T-shirt, which will be available for purchase from Teespring <strong>only for a week</strong> through Thursday, October 6. Maggie also wrote <a href=\"https://www.behance.net/gallery/43269677/Reacts-50000-Stars-Shirt\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">a blog post</a> showing all the different concepts she came up with before settling on the final design.</p>\n<p><a target=\"_blank\" href=\"https://teespring.com/react-50000-stars\">\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: 52.38095238095239%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/jpeg;base64,/9j/2wBDABALDA4MChAODQ4SERATGCgaGBYWGDEjJR0oOjM9PDkzODdASFxOQERXRTc4UG1RV19iZ2hnPk1xeXBkeFxlZ2P/2wBDARESEhgVGC8aGi9jQjhCY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2P/wgARCAAKABQDASIAAhEBAxEB/8QAFgABAQEAAAAAAAAAAAAAAAAABQAD/8QAFQEBAQAAAAAAAAAAAAAAAAAAAgH/2gAMAwEAAhADEAAAAdDVTjWLOD//xAAbEAABBAMAAAAAAAAAAAAAAAABAgMEMwASMf/aAAgBAQABBQKQVhtBXvj1EW89/8QAFhEAAwAAAAAAAAAAAAAAAAAAARAx/9oACAEDAQE/ATV//8QAFhEAAwAAAAAAAAAAAAAAAAAAARAx/9oACAECAQE/ARF//8QAHhAAAQIHAQAAAAAAAAAAAAAAAAERAhASEyJBYXH/2gAIAQEABj8CwfqiW6nNkXgkv//EAB0QAQABAwUAAAAAAAAAAAAAAAERABBBIVFhobH/2gAIAQEAAT8hMwBiwUKWto06ssOLN0Xy1//aAAwDAQACAAMAAAAQhy//xAAVEQEBAAAAAAAAAAAAAAAAAAABEP/aAAgBAwEBPxAR/8QAFREBAQAAAAAAAAAAAAAAAAAAARD/2gAIAQIBAT8Qcf/EABwQAQACAwADAAAAAAAAAAAAAAEAESExUUGB8P/aAAgBAQABPxC9WK8J5TUwZvcbDYnIW5VNKxG3W2jPsny+psn/2Q==&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 50k Tshirt\" title src=\"/static/dd4bfca3eacb85dc3c81fe91fb2e1c10/bba1f/react-50k-tshirt.jpg\" srcset=\"/static/dd4bfca3eacb85dc3c81fe91fb2e1c10/60342/react-50k-tshirt.jpg 210w,\n/static/dd4bfca3eacb85dc3c81fe91fb2e1c10/65f94/react-50k-tshirt.jpg 420w,\n/static/dd4bfca3eacb85dc3c81fe91fb2e1c10/bba1f/react-50k-tshirt.jpg 840w,\n/static/dd4bfca3eacb85dc3c81fe91fb2e1c10/e5166/react-50k-tshirt.jpg 1200w\" sizes=\"(max-width: 840px) 100vw, 840px\">\n    </span>\n  </span>\n  </a></p>\n<p>The T-shirts are super soft using American Apparel’s tri-blend fabric; we also have kids and toddler T-shirts and baby onesies available.</p>\n<ul>\n<li><a href=\"https://teespring.com/react-50000-stars\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Adult T-shirts (straight-cut and fitted)</a></li>\n<li><a href=\"https://teespring.com/react-50000-stars-kids\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Kids T-shirts</a></li>\n<li><a href=\"https://teespring.com/react-50000-stars-toddler\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Toddler T-Shirts</a></li>\n<li><a href=\"https://teespring.com/react-50000-stars-baby\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Baby Onesies</a></li>\n</ul>\n<p>Proceeds from the shirts will be donated to <a href=\"http://www.code2040.org/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">CODE2040</a>, a nonprofit that creates access, awareness, and opportunities in technology for underrepresented minorities with a specific focus on Black and Latinx talent.</p>\n<h2 id=\"archeology\"><a href=\"#archeology\" 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>Archeology </h2>\n<p>We’ve spent a lot of time trying to explain the concepts behind React and the problems it attempts to solve, but we haven’t talked much about how React evolved before being open sourced. This milestone seemed like as good a time as any to dig through the earliest commits and share some of the more important moments and fun facts.</p>\n<p>The story begins in our ads org, where we were building incredibly sophisticated client side web apps using an internal MVC framework called <a href=\"http://web.archive.org/web/20130608154901/http://shaneosullivan.github.io/boltjs/intro.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">BoltJS</a>. Here’s a sample of what some Bolt code looked like:</p>\n<div class=\"gatsby-highlight\" data-language=\"jsx\"><pre class=\"gatsby-code-jsx\"><code class=\"gatsby-code-jsx\"><span class=\"token keyword\">var</span> CarView <span class=\"token operator\">=</span> <span class=\"token function\">require</span><span class=\"token punctuation\">(</span><span class=\"token string\">'javelin/core'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">createClass</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">{</span>\n  name<span class=\"token operator\">:</span> <span class=\"token string\">'CarView'</span><span class=\"token punctuation\">,</span>\n  extend<span class=\"token operator\">:</span> <span class=\"token function\">require</span><span class=\"token punctuation\">(</span><span class=\"token string\">'container'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span>Container<span class=\"token punctuation\">,</span>\n  properties<span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n    wheels<span class=\"token operator\">:</span> <span class=\"token number\">4</span><span class=\"token punctuation\">,</span>\n  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n  <span class=\"token function-variable function\">declare</span><span class=\"token operator\">:</span> <span class=\"token keyword\">function</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">return</span> <span class=\"token punctuation\">{</span>\n      childViews<span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span>\n        <span class=\"token punctuation\">{</span> content<span class=\"token operator\">:</span> <span class=\"token string\">'I have '</span> <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n        <span class=\"token punctuation\">{</span> ref<span class=\"token operator\">:</span> <span class=\"token string\">'wheelView'</span> <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n        <span class=\"token punctuation\">{</span> content<span class=\"token operator\">:</span> <span class=\"token string\">' wheels'</span> <span class=\"token punctuation\">}</span>\n      <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>\n  <span class=\"token function-variable function\">setWheels</span><span class=\"token operator\">:</span> <span class=\"token keyword\">function</span><span class=\"token punctuation\">(</span><span class=\"token parameter\">wheels</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">this</span><span class=\"token punctuation\">.</span><span class=\"token function\">findRef</span><span class=\"token punctuation\">(</span><span class=\"token string\">'wheelView'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">setContent</span><span class=\"token punctuation\">(</span>wheels<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n  <span class=\"token function-variable function\">getWheels</span><span class=\"token operator\">:</span> <span class=\"token keyword\">function</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">return</span> <span class=\"token keyword\">this</span><span class=\"token punctuation\">.</span><span class=\"token function\">findRef</span><span class=\"token punctuation\">(</span><span class=\"token string\">'wheelView'</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">getContent</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</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>\n\n<span class=\"token keyword\">var</span> car <span class=\"token operator\">=</span> <span class=\"token keyword\">new</span> <span class=\"token class-name\">CarView</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\ncar<span class=\"token punctuation\">.</span><span class=\"token function\">setWheels</span><span class=\"token punctuation\">(</span><span class=\"token number\">3</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\ncar<span class=\"token punctuation\">.</span><span class=\"token function\">placeIn</span><span class=\"token punctuation\">(</span>document<span class=\"token punctuation\">.</span>body<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n<span class=\"token comment\">//&lt;div></span>\n<span class=\"token comment\">//  &lt;div>I have &lt;/div></span>\n<span class=\"token comment\">//  &lt;div>3&lt;/div></span>\n<span class=\"token comment\">//  &lt;div> wheels&lt;/div></span>\n<span class=\"token comment\">//&lt;/div></span></code></pre></div>\n<p>Bolt introduced a number of APIs and features that would eventually make their way into React including <code class=\"gatsby-code-text\">render</code>, <code class=\"gatsby-code-text\">createClass</code>, and <code class=\"gatsby-code-text\">refs</code>. Bolt introduced the concept of <code class=\"gatsby-code-text\">refs</code> as a way to create references to nodes that can be used imperatively. This was relevant for legacy interoperability and incremental adoption, and while React would eventually strive to be a lot more functional, <code class=\"gatsby-code-text\">refs</code> proved to be a very useful way to break out of the functional paradigm when the need arose.</p>\n<p>But as our applications grew more and more sophisticated, our Bolt codebases got pretty complicated. Recognizing some of the framework’s shortcomings, <a href=\"https://twitter.com/jordwalke\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Jordan Walke</a> started experimenting with a side-project called <a href=\"https://github.com/jordwalke/FaxJs\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">FaxJS</a>. His goal was to solve many of the same problems as Bolt, but in a very different way. This is actually where most of React’s fundamentals were born, including props, state, re-evaluating large portions of the tree to “diff” the UI, server-side rendering, and a basic concept of components.</p>\n<div class=\"gatsby-highlight\" data-language=\"jsx\"><pre class=\"gatsby-code-jsx\"><code class=\"gatsby-code-jsx\">TestProject<span class=\"token punctuation\">.</span>PersonDisplayer <span class=\"token operator\">=</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token function-variable function\">structure</span> <span class=\"token operator\">:</span> <span class=\"token keyword\">function</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">return</span> <span class=\"token function\">Div</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">{</span>\n      classSet<span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span> personDisplayerContainer<span class=\"token operator\">:</span> <span class=\"token boolean\">true</span> <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n      titleDiv<span class=\"token operator\">:</span> <span class=\"token function\">Div</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">{</span>\n        classSet<span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span> personNameTitle<span class=\"token operator\">:</span> <span class=\"token boolean\">true</span> <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n        content<span class=\"token operator\">:</span> <span class=\"token keyword\">this</span><span class=\"token punctuation\">.</span>props<span class=\"token punctuation\">.</span>name\n      <span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span>\n      nestedAgeDiv<span class=\"token operator\">:</span> <span class=\"token function\">Div</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">{</span>\n        content<span class=\"token operator\">:</span> <span class=\"token string\">'Interests: '</span> <span class=\"token operator\">+</span> <span class=\"token keyword\">this</span><span class=\"token punctuation\">.</span>props<span class=\"token punctuation\">.</span>interests\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>\n  <span class=\"token punctuation\">}</span>\n<span class=\"token punctuation\">}</span><span class=\"token punctuation\">;</span></code></pre></div>\n<h2 id=\"fbolt-is-born\"><a href=\"#fbolt-is-born\" 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>FBolt is Born </h2>\n<p>Through his FaxJS experiment, Jordan became convinced that functional APIs  — which discouraged mutation —  offered a better, more scalable way to build user interfaces. He imported his library into Facebook’s codebase in March of 2012 and renamed it “FBolt”, signifying an extension of Bolt where components are written in a functional programming style. Or maybe “FBolt” was a nod to FaxJS – he didn’t tell us! ;)</p>\n<p>The interoperability between FBolt and Bolt allowed us to experiment with replacing just one component at a time with more functional component APIs. We could test the waters of this new functional paradigm, without having to go all in. We started with the components that were clearly best expressed functionally and then we would later continue to push the boundaries of what we could express as functions.</p>\n<p>Realizing that FBolt wouldn’t be a great name for the library when used on its own, Jordan Walke and <a href=\"https://twitter.com/tomocchino\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Tom Occhino</a> decided on a new name: “React.” After Tom sent out the diff to rename everything to React, Jordan commented:</p>\n<blockquote>\n<p>Jordan Walke:\nI might add for the sake of discussion, that many systems advertise some kind of reactivity, but they usually require that you set up some kind of point-to-point listeners and won’t work on structured data. This API reacts to any state or property changes, and works with data of any form (as deeply structured as the graph itself) so I think the name is fitting.</p>\n</blockquote>\n<p>Most of Tom’s other commits at the time were on the first version of <a href=\"https://github.com/graphql/graphiql\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">GraphiQL</a>, a project which was recently open sourced.</p>\n<h2 id=\"adding-jsx\"><a href=\"#adding-jsx\" 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>Adding JSX </h2>\n<p>Since about 2010 Facebook has been using an extension of PHP called <a href=\"https://www.facebook.com/notes/facebook-engineering/xhp-a-new-way-to-write-php/294003943919/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">XHP</a>, which enables engineers to create UIs using XML literals right inside their PHP code. It was first introduced to help prevent XSS holes but ended up being an excellent way to structure applications with custom components.</p>\n<div class=\"gatsby-highlight\" data-language=\"jsx\"><pre class=\"gatsby-code-jsx\"><code class=\"gatsby-code-jsx\">final <span class=\"token keyword\">class</span> <span class=\"token operator\">:</span>a<span class=\"token operator\">:</span>post <span class=\"token keyword\">extends</span> <span class=\"token operator\">:</span>x<span class=\"token operator\">:</span>element <span class=\"token punctuation\">{</span>\n  attribute <span class=\"token operator\">:</span>a<span class=\"token punctuation\">;</span>\n  <span class=\"token keyword\">protected</span> <span class=\"token keyword\">function</span> <span class=\"token function\">render</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token operator\">:</span> XHPRoot <span class=\"token punctuation\">{</span>\n    $anchor <span class=\"token operator\">=</span> <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>a</span><span class=\"token punctuation\">></span></span><span class=\"token punctuation\">{</span>$<span class=\"token keyword\">this</span><span class=\"token operator\">-</span><span class=\"token operator\">></span><span class=\"token function\">getChildren</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">}</span><span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>a</span><span class=\"token punctuation\">></span></span><span class=\"token punctuation\">;</span>\n    $form <span class=\"token operator\">=</span> <span class=\"token punctuation\">(</span>\n      <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>form</span>\n        <span class=\"token attr-name\">method</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>post<span class=\"token punctuation\">\"</span></span>\n        <span class=\"token attr-name\">action</span><span class=\"token script language-javascript\"><span class=\"token script-punctuation punctuation\">=</span><span class=\"token punctuation\">{</span>$<span class=\"token keyword\">this</span><span class=\"token operator\">-</span><span class=\"token operator\">></span><span class=\"token operator\">:</span>href<span class=\"token punctuation\">}</span></span>\n        <span class=\"token attr-name\">target</span><span class=\"token script language-javascript\"><span class=\"token script-punctuation punctuation\">=</span><span class=\"token punctuation\">{</span>$<span class=\"token keyword\">this</span><span class=\"token operator\">-</span><span class=\"token operator\">></span><span class=\"token operator\">:</span>target<span class=\"token punctuation\">}</span></span>\n        <span class=\"token attr-name\">class</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>postLink<span class=\"token punctuation\">\"</span></span>\n      <span class=\"token punctuation\">></span></span><span class=\"token punctuation\">{</span>$anchor<span class=\"token punctuation\">}</span><span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>form</span><span class=\"token punctuation\">></span></span>\n    <span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    $<span class=\"token keyword\">this</span><span class=\"token operator\">-</span><span class=\"token operator\">></span><span class=\"token function\">transferAllAttributes</span><span class=\"token punctuation\">(</span>$anchor<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">return</span> $form<span class=\"token punctuation\">;</span>\n  <span class=\"token punctuation\">}</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<p>Before Jordan’s work had even made its way into the Facebook codebase, Adam Hupp implemented an XHP-like concept for JavaScript, written in Haskell. This system enabled you to write the following inside a JavaScript file:</p>\n<div class=\"gatsby-highlight\" data-language=\"jsx\"><pre class=\"gatsby-code-jsx\"><code class=\"gatsby-code-jsx\"><span class=\"token keyword\">function</span> <span class=\"token operator\">:</span>example<span class=\"token operator\">:</span><span class=\"token function\">hello</span><span class=\"token punctuation\">(</span><span class=\"token parameter\">attrib<span class=\"token punctuation\">,</span> children</span><span class=\"token punctuation\">)</span> <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>div</span> <span class=\"token attr-name\">class</span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">=</span><span class=\"token punctuation\">\"</span>special<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>h1</span><span class=\"token punctuation\">></span></span><span class=\"token plain-text\">Hello, World!</span><span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>h1</span><span class=\"token punctuation\">></span></span><span class=\"token plain-text\">\n      </span><span class=\"token punctuation\">{</span>children<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>div</span><span class=\"token punctuation\">></span></span>\n  <span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<p>It would compile the above into the following normal ES3-compatible JavaScript:</p>\n<div class=\"gatsby-highlight\" data-language=\"jsx\"><pre class=\"gatsby-code-jsx\"><code class=\"gatsby-code-jsx\"><span class=\"token keyword\">function</span> <span class=\"token function\">jsx_example_hello</span><span class=\"token punctuation\">(</span><span class=\"token parameter\">attrib<span class=\"token punctuation\">,</span> children</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token keyword\">return</span> <span class=\"token punctuation\">(</span>\n    <span class=\"token constant\">S</span><span class=\"token punctuation\">.</span><span class=\"token function\">create</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"div\"</span><span class=\"token punctuation\">,</span> <span class=\"token punctuation\">{</span><span class=\"token string\">\"class\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"special\"</span><span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span> <span class=\"token punctuation\">[</span>\n      <span class=\"token constant\">S</span><span class=\"token punctuation\">.</span><span class=\"token function\">create</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"h1\"</span><span class=\"token punctuation\">,</span> <span class=\"token punctuation\">{</span><span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span> <span class=\"token punctuation\">[</span><span class=\"token string\">\"Hello, World!\"</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span>\n      children\n    <span class=\"token punctuation\">]</span>\n  <span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<p>In this prototype, <code class=\"gatsby-code-text\">S.create</code> would immediately create and return a DOM node. Most of the conversations on this prototype revolved around the performance characteristics of <code class=\"gatsby-code-text\">innerHTML</code> versus creating DOM nodes directly. At the time, it would have been less than ideal to push developers universally in the direction of creating DOM nodes directly since it did not perform as well, especially in Firefox and IE. Facebook’s then-CTO <a href=\"https://twitter.com/btaylor\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Bret Taylor</a> chimed in on the discussion at the time in favor of <code class=\"gatsby-code-text\">innerHTML</code> over <code class=\"gatsby-code-text\">document.createElement</code>:</p>\n<blockquote>\n<p>Bret Taylor:\nIf you are not convinced about innerHTML, here is a small microbenchmark. It is about the same in Chrome. innerHTML is about 30% faster in the latest version of Firefox (much more in previous versions), and about 90% faster in IE8.</p>\n</blockquote>\n<p>This work was eventually abandoned but was revived after React made its way into the codebase. Jordan sidelined the previous performance discussions by introducing the concept of a “Virtual DOM,” though its eventual name didn’t exist yet.</p>\n<blockquote>\n<p>Jordan Walke:\nFor the first step, I propose that we do the easiest, yet most general transformation possible. My suggestion is to simply map xml expressions to function call expressions.</p>\n<ul>\n<li><code class=\"gatsby-code-text\">&lt;x&gt;&lt;/x&gt;</code> becomes <code class=\"gatsby-code-text\">x( )</code></li>\n<li><code class=\"gatsby-code-text\">&lt;x height=12&gt;&lt;/x&gt;</code> becomes <code class=\"gatsby-code-text\">x( {height:12} )</code></li>\n<li><code class=\"gatsby-code-text\">&lt;x&gt; &lt;y&gt; &lt;/y&gt; &lt;/x&gt;</code> becomes <code class=\"gatsby-code-text\">x({ childList: [y( )] })</code></li>\n</ul>\n<p>At this point, JSX doesn’t need to know about React - it’s just a convenient way to write function calls. Coincidentally, React’s primary abstraction is the function. Okay maybe it’s not so coincidental ;)</p>\n</blockquote>\n<p>Adam made a very insightful comment, which is now the default way we write lists in React with JSX.</p>\n<blockquote>\n<p>Adam Hupp:\nI think we should just treat arrays of elements as a frag. This is useful for constructs like:</p>\n<div class=\"gatsby-highlight\" data-language=\"jsx\"><pre class=\"gatsby-code-jsx\"><code class=\"gatsby-code-jsx\"><span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>ul</span><span class=\"token punctuation\">></span></span><span class=\"token punctuation\">{</span>foo<span class=\"token punctuation\">.</span><span class=\"token function\">map</span><span class=\"token punctuation\">(</span><span class=\"token keyword\">function</span><span class=\"token punctuation\">(</span><span class=\"token parameter\">i</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span> <span class=\"token keyword\">return</span> <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>li</span><span class=\"token punctuation\">></span></span><span class=\"token punctuation\">{</span>i<span class=\"token punctuation\">.</span>data<span class=\"token punctuation\">}</span><span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>li</span><span class=\"token punctuation\">></span></span><span class=\"token punctuation\">;</span> <span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">}</span><span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;/</span>ul</span><span class=\"token punctuation\">></span></span></code></pre></div>\n<p>In this case the ul(..) will get a childList with a single child, which is itself a list.</p>\n</blockquote>\n<p>React didn’t end up using Adam’s implementation directly. Instead, we created JSX by forking <a href=\"https://github.com/laverdet/js-xml-literal\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">js-xml-literal</a>, a side project by XHP creator Marcel Laverdet. JSX took its name from js-xml-literal, which Jordan modified to just be syntactic sugar for deeply nested function calls.</p>\n<h2 id=\"api-churn\"><a href=\"#api-churn\" 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>API Churn </h2>\n<p>During the first year of React, internal adoption was growing quickly but there was quite a lot of churn in the component APIs and naming conventions:</p>\n<ul>\n<li><code class=\"gatsby-code-text\">project</code> was renamed to <code class=\"gatsby-code-text\">declare</code> then to <code class=\"gatsby-code-text\">structure</code> and finally to <code class=\"gatsby-code-text\">render</code>.</li>\n<li><code class=\"gatsby-code-text\">Componentize</code> was renamed to <code class=\"gatsby-code-text\">createComponent</code> and finally to <code class=\"gatsby-code-text\">createClass</code>.</li>\n</ul>\n<p>As the project was about to be open sourced, <a href=\"https://twitter.com/leeb\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Lee Byron</a> sat down with Jordan Walke, Tom Occhino and Sebastian Markbåge in order to refactor, reimplement, and rename one of React’s most beloved features – the lifecycle API. Lee <a href=\"https://gist.github.com/vjeux/f2b015d230cc1ab18ed1df30550495ed\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">came up with a well-designed API</a> that is still in place today.</p>\n<ul>\n<li>\n<p>Concepts</p>\n<ul>\n<li>component - a ReactComponent instance</li>\n<li>state - internal state to a component</li>\n<li>props - external state to a component</li>\n<li>markup - the stringy HTML-ish stuff components generate</li>\n<li>DOM - the document and elements within the document</li>\n</ul>\n</li>\n<li>\n<p>Actions</p>\n<ul>\n<li>mount - to put a component into a DOM</li>\n<li>initialize - to prepare a component for rendering</li>\n<li>update - a transition of state (and props) resulting a render.</li>\n<li>render - a side-effect-free process to get the representation (markup) of a component.</li>\n<li>validate - make assertions about something created and provided</li>\n<li>destroy - opposite of initialize</li>\n</ul>\n</li>\n<li>\n<p>Operands</p>\n<ul>\n<li>create - make a new thing</li>\n<li>get - get an existing thing</li>\n<li>set - merge into existing</li>\n<li>replace - replace existing</li>\n<li>receive - respond to new data</li>\n<li>force - skip checks to do action</li>\n</ul>\n</li>\n<li>\n<p>Notifications</p>\n<ul>\n<li>shouldObjectAction</li>\n<li>objectWillAction</li>\n<li>objectDidAction</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"instagram\"><a href=\"#instagram\" 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>Instagram </h2>\n<p>In 2012, Instagram got acquired by Facebook. <a href=\"https://twitter.com/floydophone\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Pete Hunt</a>, who was working on Facebook photos and videos at the time, joined their newly formed web team. He wanted to build their website completely in React, which was in stark contrast with the incremental adoption model that had been used at Facebook.</p>\n<p>To make this happen, React had to be decoupled from Facebook’s infrastructure, since Instagram didn’t use any of it. This project acted as a forcing function to do the work needed to open source React. In the process, Pete also discovered and promoted a little project called webpack. He also implemented the <code class=\"gatsby-code-text\">renderToString</code> primitive which was needed to do server-side rendering.</p>\n<p>As we started to prepare for the open source launch, <a href=\"https://twitter.com/miekd\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Maykel Loomans</a>, a designer on Instagram, made a mock of what the website could look like. The header ended up defining the visual identity of React: its logo and the electric blue color!</p>\n<center><a target=\"_blank\" href=\"../images/blog/react-50k-mock-full.jpg\">\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: 102.3809523809524%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/jpeg;base64,/9j/2wBDABALDA4MChAODQ4SERATGCgaGBYWGDEjJR0oOjM9PDkzODdASFxOQERXRTc4UG1RV19iZ2hnPk1xeXBkeFxlZ2P/2wBDARESEhgVGC8aGi9jQjhCY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2P/wgARCAAUABQDASIAAhEBAxEB/8QAFwABAQEBAAAAAAAAAAAAAAAAAAQCAf/EABQBAQAAAAAAAAAAAAAAAAAAAAD/2gAMAwEAAhADEAAAAcas6QLRdsAP/8QAGhABAAMAAwAAAAAAAAAAAAAAAAIUJAEDQf/aAAgBAQABBQKjNSmodjU0Nb1y/8QAFBEBAAAAAAAAAAAAAAAAAAAAIP/aAAgBAwEBPwEf/8QAFBEBAAAAAAAAAAAAAAAAAAAAIP/aAAgBAgEBPwEf/8QAHBAAAgEFAQAAAAAAAAAAAAAAAAIyAQMgITFC/9oACAEBAAY/ApKSQkpuqHk7bw//xAAcEAACAQUBAAAAAAAAAAAAAAAAAREhQXHh8NH/2gAIAQEAAT8hUvqdjONiVxwiu88aI1iXcJVKGf/aAAwDAQACAAMAAAAQwwcA/8QAFBEBAAAAAAAAAAAAAAAAAAAAIP/aAAgBAwEBPxAf/8QAFBEBAAAAAAAAAAAAAAAAAAAAIP/aAAgBAgEBPxAf/8QAHhABAAIBBAMAAAAAAAAAAAAAAQARITGx0fBBUWH/2gAIAQEAAT8QKi6vZTaL8PCdLhLykV9toBZxNUVFHdtEqmFwVHioCg0n/9k=&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 website mock\" title src=\"/static/4c980ebecab37b61a1f7db2f95d91b96/bba1f/react-50k-mock.jpg\" srcset=\"/static/4c980ebecab37b61a1f7db2f95d91b96/60342/react-50k-mock.jpg 210w,\n/static/4c980ebecab37b61a1f7db2f95d91b96/65f94/react-50k-mock.jpg 420w,\n/static/4c980ebecab37b61a1f7db2f95d91b96/bba1f/react-50k-mock.jpg 840w,\n/static/4c980ebecab37b61a1f7db2f95d91b96/2d18b/react-50k-mock.jpg 893w\" sizes=\"(max-width: 840px) 100vw, 840px\">\n    </span>\n  </span>\n  </a></center>\n<p>In its earliest days, React benefited tremendously from feedback, ideas, and technical contributions of early adopters and collaborators all over the company. While it might look like an overnight success in hindsight, the story of React is actually a great example of how new ideas often need to go through several rounds of refinement, iteration, and course correction over a long period of time before reaching their full potential.</p>\n<p>React’s approach to building user interfaces with functional programming principles has changed the way we do things in just a few short years. It goes without saying, but React would be nothing without the amazing open source community that’s built up around it!</p>","excerpt":"Just three and a half years ago we open sourced a little JavaScript library called React. The journey since that day has been incredibly exciting. Commemorative T-Shirt  In order to celebrate 50,000 GitHub stars, Maggie Appleton from egghead.io has designed us a special T-shirt, which will be available for purchase from Teespring only for a week through Thursday, October 6. Maggie also wrote a blog post showing all the different concepts she came up with before settling on the final design.  The…","frontmatter":{"title":"Our First 50,000 Stars","next":null,"prev":null,"author":[{"frontmatter":{"name":"Vjeux","url":"https://twitter.com/vjeux"}}]},"fields":{"date":"September 28, 2016","path":"content/blog/2016-09-28-our-first-50000-stars.md","slug":"/blog/2016/09/28/our-first-50000-stars.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/2016/09/28/our-first-50000-stars.html"}},"staticQueryHashes":[]}