ReactJS started out as a library for XHP. XHP is Facebook’s version of PHP, which was open-sourced in 2010. The aim of creating XHP was to make frontend development easier and help avoid cross-site scripting attacks (XSS). XSS is a very common attack vector that inserts malicious code into a web application.
This is where XHP comes in. XHP has an Automatic XSS protection; all page rendering is done inside XHP and it knows what Hypertext Markup Language (HTML) is and what a context is, hence escaping all contexts without any hassle.
However, XHP failed when it comes to building dynamic web applications. Meaning, once a change occurs, or a state changes, the web application re-renders itself, causing the user to lose any information previously stored in the Document Object Model (DOM). This got the Facebook Ads Org team thinking: why do we have to re-render the entire page just because a state changed? They realized early enough that this process was terrible for performance as well as user experience.
Around the same time that Facebook started using React on the like and commenting UI, and also on the Ads product (2012), they acquired Instagram. One of the first products Instagram wanted to build was their website. After taking a good look at Facebook’s stack, Pete Hunt made a case to use React on Instagram’s website. At the time, though, React was closely coupled to Facebook’s stack. Pete Hunt did not give up: he did most of the work required to decouple React from Facebook’s stack so that Instagram could use it as well, making Instagram the first external product to use React. With this, Facebook was a step away to blessing developers around the world with the awesomeness of React.
May 2013, React was open-sourced at JSConf in the United States. Since then, developers across the world actively use React in production. Companies like, Trello, Slack, Docker, Airbnb, Khan Academy, New York Times, Codecademy to mention a few actively use React.
In April 2015, Facebook released a patent regarding the usage of React which basically says, ‘In as much as you do not sue us for patent infringement, we will give you this software for free; you can sell, distribute, import, make, and use this product. In addition, we also promise not to sue you for any patent infringement as regards this open source software.’ You can read about it here.