React SEO: how our React homepage showed Google an empty page, and the fix
Until July 2026 the HTML of our own React homepage was a single empty div. Google showed it without a description and AI crawlers read nothing. Here is why client-side React does that, the quick fix and the proper one we shipped, and a one-minute test for your site.
Until July 24, 2026, the HTML of the pixelandoak.com homepage was one empty element. People saw a full page, because React built it in their browser. Search engines saw this:
<body>
<div id="root"></div>
<script type="module" src="/assets/main.js"></script>
</body>
Every other page on the site was already written out as HTML at build time. The homepage, the one page that most needed to be read, was the exception, and Google's result for it carried no description. This is how that happens to React sites, the two fixes we shipped, and how to check yours in a minute.
Why React sites look empty to crawlers
A React app built the default way, with Vite or the old Create React App, is client-side rendered. The server sends a near-empty HTML file and a bundle of JavaScript; the browser runs the JavaScript, and the JavaScript builds the page. For a person on a decent phone that takes a second. For a crawler it depends on whether the crawler runs JavaScript at all.
- Google does, in a second step. Googlebot fetches the HTML, queues the page for rendering, runs it in an up-to-date version of Chrome and indexes what comes out (Google's JavaScript SEO basics). It works, with a delay, and anything that fails to load in that render is missing from the index.
- Most AI crawlers do not. In Vercel and MERJ's December 2024 study, GPTBot, ClaudeBot, PerplexityBot and the other major AI crawlers downloaded JavaScript files but never executed them; only Gemini (which uses Googlebot) and Applebot rendered pages. What the rest index is the empty shell.
That second group is why this matters more now than it did. In our check of 315 small-business homepages, 49 (16%) had fewer than 80 words in their HTML. Most looked like finished websites in a browser.
Fix 1: write a copy of the homepage into the HTML
The quick fix, in July, was a script that ran after the build and wrote a static version of the homepage, its hero, services and links, into dist/index.html. In the browser React replaced it with the live app. Crawlers got about 4,900 characters of real text and links to every service and city page, and Google's result got its description back.
It worked, but it meant keeping two homepages: the React one people use and the hand-written one crawlers read. Every change to one had to be made in the other, and the day someone forgot, the two would say different things.
Fix 2: render the real React tree at build time
When we rebuilt the site in October, the homepage moved to the approach we would recommend for any React site that cannot move to a framework: render the same components to HTML during the build, put that HTML inside the root element, and let React hydrate it in the browser. One homepage, two places it runs.
Our build step is about 25 lines. Stripped down, it is this:
// scripts/prerender-home.mjs, run after "vite build"
import { readFileSync, writeFileSync } from 'node:fs';
import { createServer } from 'vite';
const server = await createServer({ server: { middlewareMode: true }, appType: 'custom' });
try {
// render-home.tsx: export const render = () => renderToString(<App />);
const { render } = await server.ssrLoadModule('/scripts/render-home.tsx');
const html = readFileSync('dist/index.html', 'utf8');
const empty = /<div id="root">\s*<\/div>/;
if (!empty.test(html)) throw new Error('Homepage root missing: refusing to ship an unrendered page.');
writeFileSync('dist/index.html', html.replace(empty, () => `<div id="root">${render()}</div>`));
} finally {
await server.close();
}
On the browser side, the entry point hydrates when the HTML is already there, so React takes over the page instead of throwing it away and drawing it again:
// index.tsx
const root = document.getElementById('root');
if (root.hasChildNodes()) hydrateRoot(root, app);
else createRoot(root).render(app);
The check in the build script matters as much as the render: the build fails rather than shipping an empty homepage again.
Today the homepage's HTML carries about 4,100 words before any JavaScript runs, and our AI visibility checker passes it on every check.
Your options, from least to most work
| Approach | What crawlers get | Fits |
|---|---|---|
| Client-side rendering only | An empty shell, unless the crawler runs JavaScript | Logged-in apps and dashboards, where search does not matter |
| Prerender at build time (what we did) | Full HTML for every page you list | Marketing sites and blogs whose pages are known at build time |
| Static site generation with a framework (Next.js, Astro, React Router) | Full HTML for every page | New builds, or sites with many content pages |
| Server-side rendering on each request | Full HTML, always current | Pages that change per request or by the minute, such as prices or stock |
If you are starting a new site whose job is to be found, start with one of the last two rows. If you have an existing Vite or Create React App site, the build-time prerender above is a day's work, not a rebuild.
The other single-page-app traps we hit
- Soft 404s. A single-page app answers every address with the same shell and a 200 status, so a mistyped URL looks like a real, empty page to Google. We now ship a real
404.htmlwith a 404 status for anything that does not exist. - One title for every route. If the title and meta description are set by JavaScript, crawlers that do not run it see the same title on every page. Each page needs its own in the HTML.
- Links that are not links. Crawlers follow
<a href>. Navigation built from click handlers on buttons, or hash routes like/#/pricing, leaves pages undiscovered. - Lazy loading that does not save anything. We wrote up why React.lazy() was still downloading our chunks on every page.
How to check your React site in a minute
- Open the page in Chrome on a computer and press Ctrl+U (Cmd+Option+U on a Mac) to see the HTML the server sent.
- Press Ctrl+F and search for a sentence you can see on the page.
- If it is not in the source, crawlers that do not run JavaScript cannot read it. If the root element is empty, nothing on the page can be read.
The free AI visibility checker does the same test for you, counts the words in the HTML, and lists what each AI crawler received. For the longer version of why AI crawlers skip JavaScript, see JavaScript SEO in 2026.