AI search readiness · Frameworks
React SEO for AI search: client-side SPAs vs server rendering
React is a UI library, so robots.txt, sitemaps and llms.txt depend on the build tool or framework you pair it with. The bigger question for AI search is rendering: a client-only single-page app sends a nearly empty HTML shell, and Vercel's tests found the major AI crawlers do not run JavaScript. Server rendering or static generation fixes that.
- Edit robots.txt
- PartlyReact has no robots.txt feature. With Vite, put robots.txt in the public directory; with a framework, use its own convention.
- XML sitemap
- NoNot part of React. Generate one at build time or use your framework's sitemap feature.
- llms.txt
- PartlyServe a static llms.txt from the build tool's public directory, or generate it with your framework.
- AI crawlers
- No AI-specific setting. The risk is rendering: content that only appears after JavaScript runs in the browser is invisible to crawlers that do not execute it.
- Structured data
- React outputs no structured data. Current React docs say meta elements rendered in any component are placed in the document head; JSON-LD must be rendered as a script tag, ideally on the server.
Why client-only React apps struggle in AI search
A classic single-page app built with Create React App or a plain Vite template ships an HTML file with an empty root element and a JavaScript bundle. The browser runs the bundle, fetches data and builds the page. Anything that reads the raw HTML without running that JavaScript sees almost nothing.
That is how most AI crawlers behave. Vercel's December 2024 analysis of crawler traffic on its network reported that none of the major AI crawlers it tested render JavaScript. ChatGPT's and Claude's crawlers do fetch JavaScript files, but they do not execute them, so client-rendered content stays invisible to them. Google's Gemini was the exception because it uses Googlebot's rendering infrastructure. Google's own JavaScript SEO guide makes a similar point: server-side or pre-rendering is still a good idea because it makes a site faster for users and crawlers, and not all bots can run JavaScript.
So a React SPA can be indexed by Google and still be blank to GPTBot, ClaudeBot and PerplexityBot. If ChatGPT or Claude cannot read your pricing or product pages, they cannot cite them.
What the React team recommends now
On February 14, 2025 the React team deprecated Create React App for new apps. The current "Creating a React App" page says that to build a new app or website with React, start with a framework. It lists Next.js (App Router), React Router v7 and Expo, with TanStack Start and RedwoodSDK as newer options.
The React docs note that all of these frameworks support client-side rendering, single-page apps and static-site generation, and let you add server rendering per route. That means you can keep an interactive app shell while marketing pages, docs and product pages ship as HTML. The deprecation post also corrects a common belief: server rendering is not only for SEO, it also reduces the JavaScript users download before they see content.
Practical paths for an existing SPA:
- Move to a framework. See the Next.js guide for App Router metadata files. Astro is another option for content-heavy sites that use React components.
- Prerender public routes. If the app must stay client-rendered, generate static HTML for the pages you want found, and keep the logged-in app client-only.
- Move data fetching out of effects. The React team's post shows how fetching in
useEffectcauses network waterfalls; it also means the data is absent from any server-rendered HTML.
robots.txt, sitemap and llms.txt in a React project
React has no file conventions for these. With Vite, files in the public directory are served at the root path in development and copied as-is to the root of dist, so public/robots.txt and public/llms.txt become /robots.txt and /llms.txt. A sitemap is not built in: generate sitemap.xml from your route list in a build script, or use your framework's sitemap feature. Point to it with a Sitemap: line in robots.txt.
Meta tags and JSON-LD
The React docs say a <meta> element rendered from any component is placed in the document head. In a client-only app that tag still only exists after JavaScript runs. Render JSON-LD as a <script type="application/ld+json"> tag during server rendering or prerendering so crawlers see it in the first response. Then confirm with the robots.txt checker that AI crawlers are allowed to fetch the page at all.
Check your React site
Paste your domain to see which AI crawlers your live robots.txt lets in.
robots.txt checker
Test your robots.txt against every AI crawler
robots.txt generator
# robots.txt generated with https://www.getpicked.app/tools/robots-txt-checker
# Preset: Allow AI search, block training
User-agent: *
Allow: /
# Model training crawlers
User-agent: GPTBot
User-agent: ClaudeBot
User-agent: Google-Extended
User-agent: Applebot-Extended
User-agent: Meta-ExternalAgent
User-agent: Amazonbot
User-agent: CCBot
User-agent: Bytespider
Disallow: /
Questions
- Is React bad for SEO?
- React itself is not the problem. A client-only single-page app is, because its first HTML response has little content. Google can render JavaScript, but Vercel found that the major AI crawlers, including GPTBot and ClaudeBot, do not. Server rendering or static generation sends the content as HTML.
- Do I need Next.js to make a React site visible in AI search?
- You need HTML that contains your content. React's docs recommend starting with a framework such as Next.js or React Router, and all of them support static generation and per-route server rendering. A prerendered build from another tool also works.
- Where does robots.txt go in a Vite React app?
- In the public directory. Vite serves files there at the root path during development and copies them unchanged to the root of the dist folder at build time.
- Is Create React App still supported?
- The React team deprecated Create React App for new apps on February 14, 2025. It continues in maintenance mode, and the team encourages existing apps to move to a framework or a build tool such as Vite, Parcel or RSBuild.
Other frameworks
Related
Sources
Checked against these pages on 2026-10-19. Operators change their crawlers; check the source before relying on a detail.