Skip to content
Tutorials Center
My learning

Topics

Lesson 98 of 132 ยท Ecosystem

The React Ecosystem Map

A map of the React ecosystem - routing, data, forms, state, styling, testing, build tools and frameworks - plus how to evaluate dependencies and upgrade React safely.

React itself is small on purpose. It renders components and manages state, and it leaves routing, data fetching, forms, styling and many other jobs to other projects. That freedom is why React has the largest ecosystem in front-end development, and also why beginners feel lost: for almost every problem there are five libraries and three blog posts that disagree.

This lesson is a map, not a shopping list. For each area it explains what problem the tools solve, the main options, and how to decide, and it shows a tiny runnable version of the idea so that you understand what you are adopting. The editor has no npm packages, so named libraries appear in read-only snippets. By the end you will also know how to judge a dependency and how to read a React upgrade.

The shape of the map

Think of a React app as layers. Each layer has a "do it by hand" option, which this tutorial already taught, and a library for when the by-hand option stops scaling.

Area By hand Common libraries
Build tool none (our editor) Vite, Next.js, Parcel, Rspack
Routing location.hash, state React Router, TanStack Router, Next.js router
Server data useEffect + fetch TanStack Query, SWR, Apollo Client, RTK Query
Client state useState, useReducer, context Zustand, Redux Toolkit, Jotai, Valtio
Forms controlled inputs, form actions React Hook Form, TanStack Form, Formik
Validation hand-written functions Zod, Valibot, Yup
Styling CSS, CSS modules, inline Tailwind CSS, CSS Modules, vanilla-extract, styled-components, Emotion
Animation CSS transitions Motion (Framer Motion), React Spring
Testing none Vitest, Jest, Testing Library, Playwright
Frameworks none Next.js, React Router (framework mode), Remix, Expo

Rule of thumb: start with the by-hand option and adopt a library when you can name the specific pain it removes. A library you adopted "just in case" is a dependency you must upgrade, audit and teach to every new teammate.

Build tools and frameworks

Browsers cannot run JSX or TypeScript, resolve import 'react' from node_modules, or split code, so a project needs a build step. Two broad choices exist (see setting up a project):

  • A bundler-based single-page app such as Vite. You get a fast dev server and a static output folder you can host anywhere. Routing, data and rendering are all your choice.
  • A meta-framework such as Next.js, React Router in framework mode, or Remix. These add file-based routing, server rendering, data loading and often Server Components. They make many of the decisions below for you.

For a new product with public pages that must load fast or rank in search, a framework is usually the pragmatic default. For an authenticated dashboard behind a login, a Vite single-page app is often simpler.

Routing

A router maps the URL to a component tree and keeps the address bar, the back button and your UI in sync. At its core that is a small idea. Our sandbox cannot change the real URL path (history is unavailable), but location.hash works, which is enough to see the mechanism:

A hand-written hash router

A real router adds nested routes, dynamic segments such as /users/:id, data loaders, scroll restoration, and the history API for clean URLs. The next lessons, client-side routing and React Router, cover them. This is what the equivalent looks like with React Router (read-only, needs react-router):

JSX
// Read-only: needs the npm package react-router.
import { createBrowserRouter, RouterProvider, useParams } from 'react-router';

function Profile() {
  const { userId } = useParams();
  return <h2>Profile of {userId}</h2>;
}

const router = createBrowserRouter([
  { path: '/', element: <h2>Home</h2> },
  { path: '/users/:userId', element: <Profile /> },
]);

export default function App() {
  return <RouterProvider router={router} />;
}

Server data

Fetching data with useEffect works for a demo, but real apps need caching, deduplication, retries, background refresh, pagination and loading and error states. Writing all of that per component produces bugs such as race conditions and stale screens. Libraries like TanStack Query and SWR own that logic: you declare a key and a function, and they handle the rest.

The essential idea is a cache keyed by the request. Here is a miniature version with a shared cache so that two components asking for the same user trigger one "request":

A tiny query cache

Open the console: two components ask for user 1, but only one network request is logged. A production library adds expiry (staleTime), refetch on focus, retries, mutation helpers and devtools. Read data fetching and caching and server state to see how these concerns fit together. In a framework with Server Components, much of this moves to the server and you may need no client data library at all.

Client state

Remember the order from state management: local useState first, then lifting state, then context, then an external store. Libraries enter at the last step. Zustand and Redux Toolkit hold state outside React and let components subscribe to the slices they need, so unrelated components do not re-render. React gives you the primitive for this, useSyncExternalStore, which the store libraries use internally (external stores):

A Zustand-style store in 20 lines

Click "Add one" a few times and watch the console: only Count re-renders, because Label selected a value that did not change. That selective subscription is the whole reason people reach for these libraries. The read-only version with the real library is just as short:

JavaScript
// Read-only: needs the npm package zustand.
import { create } from 'zustand';

export const useCounter = create((set) => ({
  count: 0,
  increment: () => set((state) => ({ count: state.count + 1 })),
}));
// In a component: const count = useCounter((s) => s.count);

Forms and validation

Controlled inputs and form actions cover most forms. Reach for React Hook Form or TanStack Form when a form is large, when you want uncontrolled performance with many fields, or when you need field arrays, dependent fields and rich error handling. Pair them with a schema library such as Zod or Valibot so that one schema validates on the client and the server. The ideas are covered in form validation.

Styling and animation

Pick one primary styling approach per project and be consistent. Plain CSS and CSS Modules have zero runtime cost. Tailwind CSS generates utility classes at build time. Runtime CSS-in-JS (styled-components, Emotion) is flexible but adds JavaScript work and conflicts with Server Components, so many teams have moved toward build-time solutions such as vanilla-extract or Panda CSS. See styling. For motion, CSS transitions cover most cases; Motion (formerly Framer Motion) helps with layout and exit animations (animation).

Testing

Vitest or Jest run the tests, React Testing Library renders components and queries them the way users find things (by role and label), and Playwright drives a real browser for end-to-end tests. Details are in testing React.

React compared with Angular, Vue and React Native

Sooner or later someone asks "why React and not Angular or Vue?", in a meeting, in an interview, or in your own head when choosing a first framework. The honest answer is that all three are mature, widely used and good enough to build almost anything. The differences are about philosophy, structure and ecosystem.

The same counter in three styles

Here is a click counter in each library. The snippets are read-only (the editor runs only React); notice where the state lives and how the screen is described.

JSX
// React: a function; state through a hook; JSX is JavaScript
function Counter() {
  const [count, setCount] = useState(0);
  return <button onClick={() => setCount(count + 1)}>Clicked {count} times</button>;
}
HTML
<!-- Vue 3: a single-file component with a template -->
<script setup>
import { ref } from 'vue';
const count = ref(0);
</script>

<template>
  <button @click="count++">Clicked {{ count }} times</button>
</template>
TypeScript
// Angular: a class with a decorator, a template and a signal
@Component({
  selector: 'app-counter',
  template: `<button (click)="count.set(count() + 1)">Clicked {{ count() }} times</button>`,
})
export class CounterComponent {
  count = signal(0);
}

Key differences

React Vue Angular
What it is A UI library A progressive framework A complete platform
Language JavaScript or TypeScript, JSX JavaScript or TypeScript, HTML-like templates TypeScript (required in practice), HTML templates
Reactivity Re-run the component function when state changes, then diff the result Fine-grained: tracks which values each template uses Signals (modern), zone-based change detection (older)
Data flow One-way; state updates are explicit (setState) One-way props, optional v-model two-way sugar One-way, plus two-way [(ngModel)]
Batteries included Rendering only; you choose routing, data, forms Official router and store; some choices left Router, forms, HTTP client, DI, testing, CLI included
Learning curve Small API, but many ecosystem choices Gentle for people who know HTML Steepest: modules, DI, decorators, RxJS
Governance Meta and the community Independent, led by its creator and sponsors Google
Meta-framework Next.js, React Router (framework mode), Remix Nuxt Angular SSR / Analog

Three of these points deserve unpacking:

  1. Library versus framework. React gives you components and state and leaves everything else to you. That is freedom for an experienced team and a source of "which router?" questions for a beginner (see the ecosystem map). Angular decides most of these for you, which is a strength in a large company with many teams that must write alike. Vue sits in between.
  2. Templates versus JSX. Vue and Angular give you a template language with directives (v-if, *ngIf or @if, v-for). React has no template language: you use plain JavaScript (&&, ternaries, map) inside JSX. If you know JavaScript well, React has less to learn; if you prefer HTML-like markup, templates feel more natural. See JSX in depth.
  3. How updates are detected. React re-renders a component when its state changes and compares the result with the previous output (see reconciliation). Vue and Angular signals know exactly which expression depends on which value and update only that. Fine-grained updates need less work by default; React compensates with memo and the React Compiler, which automates the memoization.

Ecosystem and careers

React has the largest ecosystem and the largest number of job listings in most markets, which makes it a safe first choice for employment, and the biggest set of libraries (UI kits, state tools, form libraries). Angular dominates in many enterprise and consulting settings, especially where TypeScript and rigid structure are valued. Vue is strong in several regions and among small teams and agencies. Because the three share concepts (components, props, state, lifecycle, routing, state stores), skills transfer: someone fluent in React learns Vue or Angular in weeks, not months. The site has tracks for Vue.js and Angular if you want to compare hands-on.

How to choose

  • A team without strong opinions, hiring in a large market, or a project that needs the widest library choice: React.
  • A large organization that wants one prescribed way to do everything, with strong typing and built-in tooling: Angular.
  • A small team or a progressive rollout into existing HTML pages, with a preference for templates: Vue.
  • A first framework to learn: pick the one your target jobs or your team use; the concepts transfer.

Avoid choosing by benchmark charts: for typical business apps all three are fast enough, and the decisive factors are the team's skills, the hiring market and long-term maintenance.

React Native

React Native applies the same ideas (components, props, state, hooks) to native mobile apps for iOS and Android. Instead of DOM elements such as div and span you write View, Text and Pressable, and instead of CSS files you use JavaScript style objects with a Flexbox layout. The components render to real native UI widgets, not to a web view. What you learned about hooks, context and state management carries over directly, while the DOM-specific parts (CSS, window, the browser router) do not. Expo is the standard toolkit for starting. See React Native and beyond for the details, and for the web-to-native sharing options (such as React Native for Web and monorepos).

How to evaluate a dependency

Every package is code you did not write but are now responsible for. Before adding one, check:

  1. Do I need it? Can 30 lines of my own code do the job, as in the examples above? Is the platform enough (fetch, URLSearchParams, Intl)?
  2. Is it maintained? Look at the last release date, the open issue count, and whether more than one person can publish it.
  3. How big is it? Check the bundle cost (tools like Bundlephobia or your bundler's analyzer) and whether it tree-shakes.
  4. Does it support your React version and rendering model? Check for React 19, Server Components and StrictMode.
  5. Is its type support good? In a TypeScript project, first-party types matter (TypeScript with React).
  6. Can I leave? A narrow wrapper or a standard format (plain objects, URLs) keeps you from being locked in.
  7. Is its popularity real? Download counts matter less than whether people in your situation use it successfully.

Treat the ecosystem as a menu, not a requirement. Plenty of production React apps use React, a router, one data library and CSS, and nothing else.

Upgrading React and deprecations

React follows semantic versioning, and major versions are the ones that remove deprecated APIs. React publishes a migration guide and often a codemod (an automated code rewriter) with each major release. A safe upgrade routine:

  1. Upgrade to the latest minor of your current major first and fix every deprecation warning.
  2. Read the release notes and upgrade guide for the next major.
  3. Run the official codemods.
  4. Upgrade the libraries that depend on React (router, UI kit, testing library) to versions that declare support.
  5. Turn on StrictMode and run your tests and a manual smoke test.

React 19 removed several long-deprecated APIs. These two runnable examples show what happens if old code reaches the new version. The first uses ReactDOM.render, the pre-18 way to start an app:

ReactDOM.render was removed (fails on purpose)

The run logs typeof ReactDOM.render: undefined and then fails with TypeError: ReactDOM.render is not a function, so the second line (the correct createRoot call) is never reached. The fix is the one-line change to createRoot. ReactDOM.findDOMNode, string refs (ref="name"), legacy context (contextTypes) and propTypes checks on function components were removed in the same way.

The second is quieter, which makes it more dangerous. defaultProps on function components no longer does anything:

defaultProps is ignored on function components

The first line renders Hello, ! because the default is silently ignored; the second renders Hello, Guest!. Use default parameter values when destructuring props instead (props). Class components still work, but nobody writes new ones except error boundaries, which still require a class today.

This is why deprecation warnings in the dev console deserve attention. Code that merely warns today is code that stops working in the next major version.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. What is the best approach to adding libraries to a new React project?

    Every dependency has maintenance and learning costs. Adopt one when a concrete problem justifies it.
  2. 2. What problem do TanStack Query and SWR mainly solve?

    They manage server state: a cache keyed by request, deduplication, retries and background refetching, which hand-written useEffect code tends to get wrong.
  3. 3. Why do store libraries like Zustand let components pass a selector?

    With useSyncExternalStore and a selector, React compares the selected value, so unrelated components skip re-rendering when other parts of the store change.
  4. 4. What happens when you call ReactDOM.render in React 19?

    ReactDOM.render was removed in React 19. Use createRoot from react-dom/client and call root.render.
  5. 5. In React 19, what does Component.defaultProps do on a function component?

    Function components no longer read defaultProps, so a missing prop is undefined. Destructure with defaults instead, as in function Greeting({ name = 'Guest' }).

Summary

  • React renders UI; routing, server data, forms, state, styling, animation and testing come from the ecosystem.
  • Each area has a by-hand option and a library for when it stops scaling. Adopt libraries for named pain, not by habit.
  • A router syncs the URL and the UI; a query library is a cache keyed by request; a store library is useSyncExternalStore plus selectors.
  • Meta-frameworks (Next.js, React Router framework mode, Remix) bundle routing, data and server rendering; a Vite single-page app leaves those choices to you.
  • Evaluate dependencies on need, maintenance, size, React 19 support, types and exit cost.
  • Upgrade one major at a time, fix warnings first, run codemods, and update React-dependent libraries. React 19 removed ReactDOM.render, string refs, legacy context and function-component defaultProps.

Next: React Native, Expo and Beyond the Browser