Hey Faisal, React is a JavaScript library developed by Facebook for building user interfaces. Prior to React, people were using plain vanilla JavaScript, JQuery etc for building client-side applications. Facebook felt the need to build a library of their own when they realized that the existing solutions are not scalable and that it takes more time to develop stuff using existing techniques.
DOM operations are expensive. With traditional techniques, even for updating a particular nested DOM node, the entire parent container is to be re-rendered to make space for the new one. React solves this problem by using Virtual DOM. It efficiently updates only that part of the DOM that is changed/modified.
Also, React follows a component-based approach, which makes it easy to reuse code at different places.