React is a JavaScript library for building user interfaces, created by Meta (Facebook) in 2013. Instead of manually updating the page when data changes, you describe what the UI should look like for a given state, and React efficiently updates the actual page to match. It is component-based: you build small, reusable pieces and compose them into complex interfaces.
Key Features -
- Component-Based : UIs are built from independent, reusable components, each managing its own logic and appearance.
- Declarative : You describe the desired result for the current state; React figures out the DOM changes. This is easier to reason about than manual, step-by-step DOM updates.
- Virtual DOM : React keeps a lightweight copy of the DOM in memory, compares it after each change, and updates only what actually differs, which makes updates fast.
- Unidirectional Data Flow : Data flows down from parent to child through props, making the app predictable and easier to debug.
- JSX : A syntax that lets you write HTML-like markup directly inside JavaScript.
- Learn Once, Write Anywhere : The same ideas power React for web, React Native for mobile, and more.
Library vs Framework : React is a library focused only on the view (the UI). Unlike a full framework such as Angular, it leaves routing, data fetching, and state management to separate packages that you choose, which is why React apps are assembled from an ecosystem of tools.