Skip to content
UniCircle
EasyConceptualReact basics

What React is, and library vs framework

Question REACT-BAS-001

What is React, and why is it usually called a library rather than a framework? What does "declarative UI" mean?

Show the explanation

Model answer. React is a JavaScript library for building user interfaces out of reusable components. You describe what the screen should look like for a given state, and React updates the real DOM to match.

Library vs framework: React handles one job, rendering UI and managing component state. It does not prescribe routing, data fetching, forms or project structure; you pick those (React Router, TanStack Query, and so on) or use a framework built on React, such as Next.js or Remix. With a framework, the framework calls your code; with a library, you call it.

Declarative means you describe the result, not the steps:

JSX
// declarative: what the UI should be for this state
function Cart({ items }) {
  return items.length === 0 ? <p>Your cart is empty</p> : <p>{items.length} items</p>;
}
// imperative equivalent: find the element, check, set textContent, add/remove classes... by hand

When items changes, React works out the minimal DOM changes itself. That removes a whole class of bugs where the screen and the data drift apart.

Original UniCircle question. Last reviewed 22 Oct 2026.