# React SEO Best Practices: Prerender or SSR, Decide by Route

> React SEO comes down to what HTML each route ships. Choose prerendering, SSR or Next.js by whether you can list your URLs at build time, then audit the output.

- URL: https://missiongrowth.io/blog/react-seo
- Published: 2026-10-22 · Updated: 2026-11-18
- Author: Furkan Aktaş, Co-Founder, Mission Growth
- Publisher: Mission Growth. Company facts: https://missiongrowth.io/llms.txt

Is React SEO friendly? It is, when each route ships real content in its first HTML. This tutorial helps you choose a rendering path for the app you already have: prerendering, server rendering or Next.js. It ends with commands you can run today.

## Is React bad for SEO? React SEO depends on the setup you ship

React is not bad for SEO; the setup is, because a client-rendered React app returns an empty root element and the content exists only after scripts run, while server-rendered and prerendered setups return it in the first HTML.

Open view-source on a Vite single-page app and you will usually find a `<div id="root"></div>` and a script tag. Google can render that shell and index what appears. Link previews and crawlers that do not run scripts only ever see the empty div.

The rule that picks your path is one question: can you list every indexable URL at build time, and will those URLs stay valid until the next deploy? If yes, produce the HTML once during the build. If the data behind the pages changes between deploys, or the catalog is too large to list, the HTML has to be produced per request.

How Googlebot queues and renders JavaScript is covered in our [JavaScript SEO](https://missiongrowth.io/blog/javascript-seo) guide, so this post stays on the React-specific choices. Crawlers outside Google matter here too, and [technical GEO](https://missiongrowth.io/blog/technical-geo) covers them. We migrated our own React single-page app to prerendered static HTML for 20 marketing pages because AI crawlers do not execute JavaScript.

The table below applies that rule to four common starting points. Each row says what the first HTML holds, which path fits and what it breaks.

::dataset{key="react-starting-points" name="React starting points and the rendering path each one fits"}

| Starting point | What the first HTML holds | Path | What it costs or breaks |
|---|---|---|---|
| Create React App project | An empty root element; all content arrives with the scripts | Move to a framework, as react.dev advises for any app that needs routing | Create React App was deprecated on February 14, 2025 and has no active maintainers, so nobody will fix a rendering gap for you |
| Vite SPA on BrowserRouter or createBrowserRouter, indexable URLs known at build time | An empty root element until you prerender | Adopt React Router framework mode and prerender, or use vite-react-ssg as the React static generation package | Framework mode is a migration, and a build-time list goes stale the moment a CMS publishes a page after the build |
| Catalog or feed that changes faster than you deploy, or is very large | A complete page, but only if the server builds it per request | Server rendering in framework mode, or Next.js with server rendering or incremental static regeneration | You run a server and pay for rendering on each request that is not cached |
| Next.js App Router project | Server Components output, plus Client Components prerendered to HTML together with the RSC Payload | Stay on the router and render what must be indexed on the server | `notFound()` after streaming has started keeps a 200 status and adds a noindex tag, so a missing page does not return a real 404 |

Two more starting points do not need a row. An app behind a login can stay client-rendered, because nothing in it is meant to be indexed. A legacy stack where you cannot touch the build is the one place dynamic rendering comes up, and Google calls dynamic rendering a workaround and not a recommended solution, so treat it as a stopgap and never as the plan.

Choosing a React SEO framework comes down to that one rule. For a Create React App project, the React team's rule of thumb is that if your app needs routing, you would probably benefit from a framework. Once routes exist, the next decision is [how to group URLs into folders](https://missiongrowth.io/blog/site-architecture) and how deep each page sits.

Produce the HTML before the request when the URL list is known at build time, and produce it per request when the list is not.

The Next.js row deserves a second look if you already run App Router. A page that streams its first bytes before `notFound()` runs has already sent a 200. Next.js then adds a noindex tag to the response, so the page stays out of the index while the status code still says it exists.

We come back to this in the audit, because a status code is something you can only see by requesting the URL.

## Prerender a React app with React Router framework mode

React Router's framework mode prerenders routes at build time through one `prerender` setting, which exists only in that mode and leaves out dynamic paths unless you list them. Two conditions decide whether it works for your app.

The first is the mode. The `prerender` setting is a framework-mode feature, and framework mode wraps data mode with a Vite plugin. An app on BrowserRouter or createBrowserRouter has no `prerender` setting at all. To use it you must adopt framework mode first, and that is a real migration of your route definitions and entry files.

If you would rather not migrate, vite-react-ssg is the React package for static generation on Vite.

The second condition is the list. With `prerender: true` React Router renders only the static paths in your `routes.ts`. A path like `/blog/:slug` is excluded because the parameter values are unknown at build time. To get those pages you pass an array of paths, or a function when the slugs have to be fetched.

The example below is adapted from the React Router docs, and `getPostSlugsFromCMS` is a placeholder for however your site reads its content.

```ts
// react-router.config.ts (adapted from the React Router pre-rendering docs)
import type { Config } from "@react-router/dev/config";

export default {
  ssr: false,
  async prerender({ getStaticPaths }) {
    const slugs = await getPostSlugsFromCMS(); // placeholder: your CMS call
    return [
      ...getStaticPaths(),
      ...slugs.map((slug) => `/blog/${slug}`),
    ];
  },
} satisfies Config;
```

The build log is your first proof that it worked. React Router prints one line per generated file, and every prerendered path gets its own `index.html`, for example `build/client/blog/my-first-post/index.html`, next to a `.data` file. If a URL you care about has no line in that log, it is not in the prerender list.

::figure{src="/blog/figures/react-seo-1.svg" alt="Flow from the prerender setting through the URL list to a per-route index.html file; unlisted URLs reach the SPA fallback file when the host is set to serve it" caption="A prerender list decides which URLs get their own index.html; with ssr false, unlisted paths reach the SPA fallback shell only if the host is set to serve it." width="720" height="236"}

The last piece is what happens to everything outside the list. With `ssr: false` and a partial list, React Router also writes a SPA fallback file, `build/client/__spa-fallback.html` when `/` is prerendered. That file is a shell that hydrates any other path in the browser.

React Router's docs say you can configure your deployment server to serve this file for any path that would otherwise 404; some hosts do this by default and others do not, and its example is a host that supports a _redirects file.

A CMS page published after the build is missing from the prerender list, so it is a shell or a 404 until the next build.

That is the stale-list failure from the table, and the reason a fast-moving catalog belongs on server rendering.

::dataset{key="react-router-prerender-values" name="React Router prerender setting values and what each one renders"}

| `prerender` value | Which URLs get an index.html | What to watch |
|---|---|---|
| `true` | Static paths from routes.ts | Dynamic paths such as `/blog/:slug` are left out |
| An array of paths | Exactly the paths you list | Every new slug needs a rebuild |
| A function | Static paths plus whatever the function returns | The function runs at build time, so the list is as fresh as the last build |

Older guides send developers to other tools, and one popular React SEO tutorial on dev.to gets a package wrong. It installs `vite-ssg` and registers it as a Vite plugin in a React project.

The package describes itself as static-site generation for Vue 3 on Vite, so that guide hands you a Vue 3 package, and in its comments one reader reports "Cannot find package 'vue'" and another the same error for 'vue-router'.

Use vite-react-ssg for React instead. Its maintainers now point React Router v7 users to the router's own SSG. react-snap is the older zero-config prerenderer readers still ask about; read its own README before building on it.

For a new project, start from the framework-mode config above rather than from Create React App, which has no active maintainers.

If your answer to the table's URL-list question was "no, the list changes faster than I deploy", skip this section. Server rendering in framework mode or Next.js produces the HTML per request, and the audit at the end of this post still applies to whatever files or responses you get.

## Put title, description and canonical where crawlers read them

A React route should render exactly one title, because when a layout and a page both render one, React places both in the head and the React docs call the behavior of browsers and search engines undefined.

React 19 sees `<title>`, `<link>` and `<meta>` in any component and has them hoisted to the head of the document automatically. That works in client-only apps, streaming server rendering and Server Components, so the tags alone are no longer a reason to install a library.

What goes wrong is ownership. A shared layout sets a default title for the site, a page component sets its own, and now two titles sit in the head. So the rule is that one route component owns the title, and layouts either render no title or render it only on routes that have no page-level component. Here is a page that owns all three tags.

```jsx
export function PostPage({ post }) {
  return (
    <article>
      <title>{post.title}</title>
      <meta name="description" content={post.summary} />
      <link rel="canonical" href={`https://example.com/blog/${post.slug}`} />
      <h1>{post.title}</h1>
    </article>
  );
}
```

react-helmet-async still has a job, a narrower one than most tutorials give it. The React team says libraries can offer more powerful features, like overriding generic metadata with route-specific metadata based on the current route.

If your site has a default description in the layout and a few routes need to replace it, that is where a library earns its place. For plain tags on a route, the component above is enough and needs no install. The same goes for the older react-helmet: you do not need either one to get a unique title onto a page.

One limit applies whatever you choose. Hoisting happens after the component renders, so the tags exist in the raw HTML only for prerendered or server-rendered routes. In a client-only app the head of the served file is still empty, and the crawler that does not run scripts never sees your title.

Our [canonical tag](https://missiongrowth.io/blog/canonical-tag) guide covers which URL the canonical should point to. Open Graph tags follow the same rule as the title: render them once, in the route component that owns the page.

## Audit the build output before Google does

The fastest React SEO audit is a short set of shell checks over the build folder, because a prerendered route either has its title, h1, canonical and JSON-LD in the file or it does not. Run them from your project root after the build. They are a worked example you can copy and adapt, and they assume the `build/client` folder React Router writes.

```bash
# 1. Routes that shipped without an h1 (an empty shell)
find build/client -name index.html -exec grep -L '<h1' {} +

# 2. Routes with no canonical link, and routes with no JSON-LD in the raw HTML
find build/client -name index.html -exec grep -L 'rel="canonical"' {} +
find build/client -name index.html -exec grep -L 'ld+json' {} +

# 3. Every sitemap URL that has no prerendered file
SITE="https://example.com"   # your origin
grep -o '<loc>[^<]*</loc>' build/client/sitemap.xml | sed 's/<[^>]*>//g' |
while read -r url; do
  path="${url#"$SITE"}"
  [ -f "build/client${path%/}/index.html" ] || echo "no file: $url"
done
```

Each `grep -L` prints the files that do not match, so an empty result is a pass. The first command catches empty shells. The second catches routes where the canonical or the JSON-LD is rendered by a component that only runs in the browser; checking for JSON-LD in the raw HTML per template is more reliable than trusting that a component rendered it.

The third is the one that finds the stale-list failure from the previous section: every sitemap URL must have a prerendered file, and any line it prints is a URL Google will meet as a shell or a 404.

::figure{src="/blog/figures/react-seo-2.svg" alt="Checklist of build-output checks: h1 present, canonical present, JSON-LD present, every sitemap URL has a prerendered file" caption="A React SEO build audit: three greps and one sitemap diff catch most empty-shell routes before launch." width="720" height="253"}

The script cannot see everything, so four React SEO best practices stay manual checks:

- **Links.** Google can only discover links that are `<a>` elements with an href. React Router's Link component renders a progressively enhanced `<a href>`, so it passes. A button that calls `navigate`, or a click handler on a div, is not a link to a crawler. In your build output, search for an anchor with an href for every route you want found.
- **Status codes.** In Next.js, `notFound()` after streaming has started keeps a 200 status plus noindex, so test a missing URL with `curl -I` and check that you get a real 404 status. For a client-rendered SPA, Google notes that meaningful HTTP status codes can be impossible or impractical; the JavaScript SEO guide linked earlier covers soft 404 handling.
- **Blocked files.** Google does not render JavaScript from blocked files or on blocked pages, so a robots.txt rule that covers your bundle directory can leave the page looking empty. Check robots.txt for blocked JavaScript files before you check anything else.
- **Client-side redirects.** A `navigate` call in an effect is a browser redirect. Anything that must move permanently needs a real 301 at the server or host.

The sitemap deserves one paragraph of its own. An [XML sitemap](https://missiongrowth.io/blog/xml-sitemap) lists the URLs you want crawled, and in a prerendered React site it should be generated from the same source as the prerender list, so the two cannot drift. When they do drift, the diff above shows you where. Generating both from one function is the cheapest fix we know for it.

The decision, restated: ask whether you can list every indexable URL at build time, prerender in framework mode when you can, render per request when you cannot, and let the grep output decide whether the build is ready. Your next step is to run these checks against your current build today. If any of them prints a file, fix that route before you touch a plugin or a framework.

## FAQ

### Are React apps SEO friendly?

A React app is SEO friendly when each indexable route ships its content in the first HTML. A client-rendered app does not, because the content exists only after scripts run, while a prerendered or server-rendered app does.

### How do you achieve good SEO with a pure React app?

Make the first HTML complete, then give each route one title, a description and a canonical. A pure client-rendered app has an empty root element, so the practical route is prerendering the routes whose URLs you can list at build time.

### How to make a React SPA crawlable?

Use `<a href>` links through a Link component, keep clean history paths, and serve real HTML for the routes you want indexed. Google can only discover links that are anchor elements with an href, so a button that calls `navigate` is invisible to the crawl.

### Is React still bad for SEO?

React is not bad for SEO when the setup ships real HTML. The setup decides the outcome: a client-only shell makes content depend on script execution, while framework mode with `prerender` or a server-rendering framework returns it in the first response.

### Is React 19 SEO friendly?

React 19 improves one part of it. It renders title, meta and link from any component and hoists them to the head, in client-only apps as well as streaming server rendering and Server Components. In a client-only app the raw HTML head is still empty, so prerendering is still the step that puts those tags in the file a crawler reads.

### Next.js or prerender for a small Vite site?

Prerender if you can list every indexable URL at build time and that list changes only when you deploy. Adopt React Router framework mode, set `prerender`, and run the audit; move to Next.js or server rendering when pages appear faster than you deploy or the catalog is too large to list.
