326/361

What is React? Describe the benefits of React

Quiz · React
Easy
5 min
react
fundamentals

TL;DR

React is a JavaScript library for building user interfaces out of components. You describe what the UI should look like for a given state, and React works out the DOM changes needed to get there. Its main benefits are declarative rendering, composable components, one-way data flow, and a very large ecosystem. Since React 18 it also has a concurrent renderer, and since React 19 it has Server Components and Actions as first-class features.

What React actually is

React is the core library (react) plus a renderer (react-dom for the browser, React Native for mobile, and others). On its own it is deliberately small: components, hooks, context, and a scheduling/reconciliation engine. Routing, data fetching and bundling come from frameworks (Next.js, React Router v7/Remix) or from libraries you pick.

function Counter() {
  const [count, setCount] = useState(0);
  return (
    <button onClick={() => setCount(c => c + 1)}>
      Clicked {count} times
    </button>
  );
}

You never write button.textContent = .... You write a function from state to UI, and React keeps the DOM in sync.

Benefits

  • Declarative UI. You describe the end state rather than the steps to mutate the DOM. This removes a whole class of "forgot to update that element" bugs.
  • Components and composition. UI is broken into reusable, testable functions. Composition (children, props, custom hooks) replaces inheritance.
  • Predictable data flow. Data flows down through props and changes flow up through callbacks, which makes state easy to trace.
  • Hooks. Stateful logic (useState, useEffect, custom hooks) can be shared without HOCs or render props.
  • Efficient updates. Reconciliation diffs element trees and applies minimal DOM mutations. React 18 adds automatic batching and interruptible rendering (useTransition, useDeferredValue) so urgent input stays responsive.
  • Learn once, write anywhere. The same model works for web, native (React Native), SSR and static generation.
  • Server rendering story. Streaming SSR, selective hydration (18) and Server Components (19, through frameworks) reduce the JavaScript sent to the client.
  • Ecosystem and hiring. Mature tooling (DevTools, Testing Library, TypeScript types) and a large talent pool.

Downsides worth acknowledging

  • It's a library, not a framework, so teams must choose routing, data and state solutions. That leads to decision fatigue and inconsistency between projects.
  • Re-rendering performance needs care: unstable props, oversized contexts, and missing keys cause wasted work. The React Compiler (stable since late 2025) automates much of the memoization people used to do by hand.
  • The runtime adds bundle weight compared with compile-time frameworks such as Svelte or Solid.
  • The mental model (render purity, effects, closures over stale state) takes time to learn properly.

In an interview, mention…

  • "UI = f(state)". React re-runs your component when state changes and reconciles the result.
  • Composition and one-way data flow are the architectural wins. The virtual DOM is an implementation detail, not the main selling point.
  • Modern React means concurrent rendering (18), Server Components, Actions and use (19), and the React Compiler. Show you know where the library is heading.
  • Name the trade-offs honestly (ecosystem choices, runtime cost) and say when you'd choose something else.

Spotted a mistake or a rights concern? Report an issue