Full answer
Search engines index what they can see. Googlebot can execute JavaScript, but rendering happens in a second step that may be delayed, and other crawlers and social preview bots (Open Graph for chat apps and social posts) often read only the initial HTML. A pure CSR app returns <div id="root"></div>, so these tools see nothing.
What to do:
- Put content in the first HTML response. Use SSR, SSG or ISR through a framework such as Next.js or React Router framework mode. Streaming works too.
- One URL per piece of content. Use real paths (History API) and not only state or hash fragments. Make sure the server returns 200 for real pages and a true 404 status for missing ones, not a 200 with an error screen.
- Per-page metadata. Each page needs a unique
<title>, description, canonical URL and Open Graph tags. In React 19 you can render<title>,<meta>and<link>inside any component and React hoists them to the document head. Frameworks also provide metadata APIs. - Crawlable links. Use real
<a href>elements for navigation, not click handlers on divs. - Semantic structure. One
h1, ordered headings, lists,alttext. This helps both crawlers and accessibility. - Performance. Core Web Vitals influence ranking signals and user experience. Optimize LCP and layout shift.
- Discovery files.
sitemap.xml,robots.txt, and structured data (JSON-LD) for rich results. - Do not hide important content behind interactions that require clicks or infinite scroll without URLs (provide paginated URLs).
Verify with the "view source" page, Google Search Console's URL inspection, and a crawler that does not run JavaScript.
When a logged-in app has no SEO needs (a dashboard), CSR is fine. For public marketing and content, choose server-rendered output.
The example renders a document with page-level metadata and shows the resulting head.
import { renderToString } from 'react-dom/server';
function CoursePage({ course }) {
return (
<article>
<title>{course.title + ' | Schoolabe'}</title>
<meta name="description" content={course.summary} />
<link rel="canonical" href={'https://example.com/courses/' + course.slug} />
<h1>{course.title}</h1>
<p>{course.summary}</p>
<a href="/courses">All courses</a>
</article>
);
}
function Document({ children }) {
return (
<html lang="en">
<head>
<meta charSet="utf-8" />
</head>
<body>{children}</body>
</html>
);
}
const course = { title: 'React Basics', slug: 'react-basics', summary: 'Learn components, props and state.' };
const html = renderToString(
<Document>
<CoursePage course={course} />
</Document>
);
const head = html.match(/<head>([\s\S]*?)<\/head>/)[1];
console.log('head: ' + head);
console.log('h1 is in the first HTML: ' + html.includes('<h1>React Basics</h1>'));This ran as a script with renderToString. The title, meta and link tags were written inside the page component, and React placed them in the head of the document. The search engine behaviour itself was not tested. Output of the run: head: <meta charSet="utf-8"/><title>React Basics | Schoolabe</title><meta name="description" content="Learn components, props and state."/><link rel="canonical" href="https://example.com/courses/react-basics"/> h1 is in the first HTML: true
Key points
- A CSR app sends empty HTML. Crawlers and link previews may not run JavaScript, so content can be missed.
- Render important content on the server (SSR, SSG, ISR) so it is in the first HTML.
- Give each page a real URL, a unique title, description and canonical link, and return correct status codes.
- React 19 hoists title, meta and link tags from components into the head.
- Use semantic HTML, real links, a sitemap and good Core Web Vitals. Verify with view source.
Common mistakes
- Shipping an empty HTML shell for public content pages.
- Using click handlers on divs instead of links.
- Returning status 200 for pages that do not exist.
- Using the same title and description on every route.
- Hiding content behind infinite scroll with no paginated URLs.
Follow-ups
- How would you check what a crawler sees on a page?
- How do you handle metadata in Next.js or React Router?
- Why do social link previews often fail for client-rendered apps?
Tips
- Say "React is fine, the rendering strategy decides".
- Mention status codes and unique URLs, not only SSR.
- Name a way to verify, such as view source and Search Console.