React library was mainly developed to solve a specific problem and that was: When you need to manipulate or render large blocks of data-heavy content, like a photo gallery or lists containing hundreds of items similar to newsfeed in facebook , react might be a preferred option.For applications like these, you might want to take advantage of React’s virtual dom which keeps two copies of the dom viz the original one and an updated one that reflects changes fed in from the lifecycle methods of the view. The two versions are run through a React function that singles out the differences and outputs a stream of DOM operations that only alter the parts of the view that have been actually altered.This allows it to handle heavy dom manipulations. Eventually there were many additions done to Reactjs that transformed it from a simple view library to mainstream framework for web development.
Big to huge project can span on many years, being worked on by many different people with many different skills, best practices and preferences. This means that over the years, as technologies and demands changes, the codebase also needs to reflect these changes.JavaScript world changes constantly, and React allows us to swap out small components of our application for better and updated modules instead of waiting around and hoping your framework will innovate.It simply follows unix philosophy in this regard.
The main difference between react and angular was that "Angular adds JS into HTML while React adds HTML into JS".
Since major share of the web traffic today comes from mobile phones it became essential to use a framework that renders sites on phones faster.The rendering performance of React library is much more optimized which allows it render transitions between web components faster and coupled with server side rendering there was a huge performance boost by reducing the initial loading time.
With addition of Reactnative things started to turn toward the side of React since developers were easily able to port existing sites to mobile apps with ease and deploy them of both android and ios simultaneously.But the core advantage of Reactnative lies in the fact that it does not simply use webviews to render app but utilizes native components directly over a JS wrapper which gives it huge performance boost over other hybrid frameworks.
You can check out my post on when to switch to react or stick with angular here: When to use angular or react
Eventually there will be a framework/library that will replace Reactjs but for now it has taken over web development world and will continue to rise for some period of time.