Skip to main content

React Was First Deployed on Facebook's News Feed

React did not begin as a library for the world. It began as a fix for one of the busiest pages on the internet. Around 2010 and 2011 Facebook engineers were fighting the cost of keeping a constantly updating feed of posts in sync with the browser's DOM, and Jordan Walke built a prototype, initially called FaxJS, that described the interface as a tree of components instead of hand written DOM edits. The first production deployment came in 2011, on Facebook's News Feed. Instagram, acquired in 2012, adopted the same library soon after.

The technical bet behind that deployment was simple to state and strange at the time. Rather than mutate the page directly, you describe what the interface should look like for the current data, and the library works out the smallest set of real DOM changes needed. React keeps a lightweight description of the tree in memory, compares the new description with the previous one, and applies only the differences. That comparison step is the reconciliation algorithm, and it is the reason you pass stable keys when rendering lists: the key is how the library matches items between renders instead of guessing.

The inspiration for the component model came from XHP, an earlier Facebook project that let developers write custom HTML elements inside the PHP stack. Components that compose into other components, with their own markup and logic, turned out to be a good shape for a feed where every row is a slightly different composition of avatars, text, media, and reaction summaries. The News Feed also needed long lived, stateful widgets that survive navigation and receive live updates, which is why React's model has always been about state driving the view rather than about assembling one static page.

It is worth remembering how hostile the environment was. The library was written against browsers that are now ancient, where changing one large subtree could stall the main thread, and where the team's own answers, hand tuned DOM updates sprinkled with application logic, were exactly the kind of code that breaks when a product changes. Moving that responsibility into the library meant that a product engineer could express intent and let the framework pay the performance tax, and the initial public demonstration at a JavaScript conference in May 2013 made that case to an audience that was not immediately convinced.

For working developers the practical value of this origin story is diagnostic. Problems that React solves well are problems that existed in the News Feed: deep component trees, frequent state changes, lists that reorder, and views that must stay consistent with data. Problems it does not solve on its own, such as data fetching strategy, caching, and server state, are the ones Facebook handled with its own internal patterns, which is why the surrounding ecosystem grew up around the library rather than inside it. When you reach for tooling, you are choosing among answers to questions the core never claimed to answer.

So the next time you wonder why React feels the way it does, with its unidirectional data flow, its insistence on describing rather than mutating, and its occasional need for escape hatches into imperative DOM code, remember where it was born. A feed that never stops changing, rendered for a billion people, needed a rendering model that could survive constant updates without drifting out of sync. Everything else in the library follows from that constraint.

We use cookies for ads and analytics.