What is React and what are its main features?
React is an open-source JavaScript library for building user interfaces, created by Facebook (Meta) in 2013. It is component-based, declarative, and unidirectional — you describe what the UI should look like for a given state, and React figures out how to update the DOM efficiently.
Component-based — UI is built from small, reusable components that manage their own state and compose into larger ones.
Declarative — you describe the desired UI; React diffs the previous and next descriptions and applies minimal DOM changes.
Virtual DOM — an in-memory tree of UI elements; React reconciles changes against the real DOM in batches for performance.
JSX — HTML-like syntax that compiles to JavaScript function calls, making component markup readable.
Unidirectional data flow — data flows from parent to child via props; events bubble back up via callbacks. Predictable to reason about.
Hooks — modern functional components manage state, side effects, and context with
useState,useEffect, and friends.Ecosystem — React Router, Redux/Zustand, React Query, Next.js, React Native — the largest UI library ecosystem on the web.
Go beyond 'it's a library for building UIs.' Mention the virtual DOM, component architecture, unidirectional data flow, and declarative model. Distinguishing React as a library (not a framework) shows precision.