Skip to main content
CodingMarble

Web development

React vs Next.js: Which Should You Learn First?

React is a library for building interface components, while Next.js is a framework built on React that adds routing, server rendering and a build system. Learn React fundamentals first, then Next.js when you need public pages that search engines can read or a project that needs a server.

By CodingMarble · Published · 4 min read

A silver iMac on a desk in a bright room
Photo: Lee Campbell on Unsplash

A library and the framework built on top of it

React answers one question: how do you describe an interface as a tree of components that update when data changes? It gives you components, props, state and hooks. It does not tell you how to move between pages, where to fetch data, how to build for production or how to serve the result. Those decisions are left to you, which is why a plain React project is usually assembled with a build tool, a router and a data-fetching approach.

Next.js takes React and makes those decisions for you. It supplies a file-based router, a build pipeline, ways to render on a server, an image and font system, and conventions for API endpoints. Everything you learn about components and hooks still applies inside Next.js; the framework adds a layer around it. That relationship is why the learning order matters: Next.js is easier to understand once React itself is familiar.

Routing: configured versus derived from folders

In a plain React app you install a router package and describe your routes in code, mapping each path to a component. That is flexible and explicit, and it teaches you how navigation works. In Next.js the folder structure is the route table: a folder named about containing a page file becomes the about page, and square brackets in a folder name create a dynamic segment such as a product identifier.

File-based routing removes setup and keeps large sites consistent, and it enables features such as nested layouts that persist between pages. The trade-off is that you work inside the framework's conventions and need to learn special file names. Check the current Next.js documentation for the router your version recommends, since the framework has had more than one routing model.

Rendering modes: client, server and static

Rendering is where the two differ most. A plain React app normally renders in the browser: the server sends a nearly empty HTML file and a JavaScript bundle, and the browser builds the page after the script runs. This is client-side rendering. It works well when the user is already signed in and the content is private, because search engines do not need to read it.

Next.js can render components on the server for each request, so the browser receives finished HTML, or it can generate pages ahead of time at build time and serve them as static files, which is static rendering. A single Next.js project can mix all three, choosing per page or per component. The practical results are faster first content on slow devices and HTML that crawlers can read without running your scripts.

TSX· A Next.js page that fetches on the server, with no loading state in the browser
// app/products/page.tsx
type Product = { id: number; name: string };

export default async function ProductsPage() {
  const res = await fetch("https://api.example.com/products", {
    cache: "no-store",
  });
  if (!res.ok) throw new Error("Could not load products");
  const products: Product[] = await res.json();

  return (
    <ul>
      {products.map((p) => (
        <li key={p.id}>{p.name}</li>
      ))}
    </ul>
  );
}

Caching behaviour for fetch has changed between Next.js versions, so confirm in the documentation for your installed version how to opt in or out of caching. The point of the example is the shape: the component itself is asynchronous and runs on the server, which a plain React component in the browser cannot do in this way.

Data fetching and what it means for SEO

In plain React, data is usually fetched after the component mounts, using an effect or a data library. The user sees a loading state first, then the content. This is a sensible pattern for dashboards, where a spinner is acceptable. In Next.js you can fetch on the server before sending the page, so the content is already in the HTML.

For SEO, that difference is the main reason teams choose a framework. Search engines can execute JavaScript, but relying on that adds delay and risk, and social media link previews do not run scripts at all. Pages that exist to attract visitors, such as articles, product pages and landing pages, benefit from arriving as complete HTML with their own title and description. To verify your own pages, view the source or fetch the URL without JavaScript and check that the headline, text and meta tags are present.

Deployment and operating cost of complexity

A plain React build produces static files, which any file host or content delivery network can serve. There is no server to maintain, which is a real advantage for small tools. A Next.js app that uses server rendering needs a Node.js runtime or a platform that understands the framework, and its behaviour depends on features such as caching and edge functions that vary by host. A fully static export avoids that, at the cost of losing server features.

Servers bring responsibilities: environment variables, secrets that must never reach the browser, logs, restarts and updates. If you are learning, do not let this scare you off, but be aware that Next.js widens what you are expected to understand. Our hosting comparison for Next.js covers the options in more depth.

Recommended learning order and when plain React is enough

  1. HTML, CSS and modern JavaScript, including async code and modules.
  2. React fundamentals: components, props, state, effects, lists, forms, and fetching data from an API.
  3. One small plain React project, such as a task manager or a catalogue with filters.
  4. Next.js: routing, layouts, server and client components, data fetching, metadata and deployment.
  5. A Next.js project with real public pages, such as a blog or a small business site.

Plain React is enough when the whole app lives behind a login, for example an admin dashboard, an internal tool or a data-entry screen. Search engines never see those pages, users expect to load once and then work, and a static host plus a separate API is simple to run. It is also enough for a widget embedded inside another site.

Choose Next.js when you need public, indexable pages, per-page metadata, faster first load for first-time visitors, or a single project that holds both the pages and their server code.

Practical tip: decide by asking one question, who must be able to read this page without logging in. If the answer is search engines or link previews, you want server-rendered HTML. If the answer is nobody, plain React is enough.

Need this built properly for your business?

CodingMarble is a remote studio in India that builds websites, apps and games on fixed packages with the scope written down before payment. Try the free tools we run, or start a project when you are ready.