MIGRATION PLAYBOOK · REACT / V0 / BOLT → ASTRO + CLOUDFLARE

Convert React SPAs toStatic Astro + React Islands

Have an existing React app, v0 prototype, Bolt project, or Next.js marketing site? Keep the interactive components you actually need by dropping them straight into Astro 7 as selective React Islands — while converting headings, copy, navigation, and SEO pages to 0 KB JS HTML.

MIGRATION WORKSPACE

Move carefully. Keep control.

7 steps
Step 1 of 7

1. Split your React component tree: static chrome vs stateful Islands

Static layout (Navbar, Hero, Feature cards, Pricing matrix, Testimonials, FAQ <details>, Footer) becomes plain .astro components with 0 KB browser JS.

Open full instructions
Example preview01
1. Split your React component tree: static chrome vs stateful Islands
01Read instructions
02Review staging changes
03Verify before cutover

Illustration · not connected to your accounts

Step 2 of 7

2. Add @astrojs/react while preserving output: 'static'

Run npx astro add react inside your Astro project (installs @astrojs/react, react, and react-dom).

Open full instructions
Example preview02
2. Add @astrojs/react while preserving output: 'static'
01Read instructions
02Review staging changes
03Verify before cutover

Illustration · not connected to your accounts

Step 3 of 7

3. Replace react-router-dom with file-based Astro pages

Move /about, /services, /pricing, and /estimate into src/pages/*.astro wrapped in shared BaseLayout.astro.

Open full instructions
Example preview03
3. Replace react-router-dom with file-based Astro pages
01Read instructions
02Review staging changes
03Verify before cutover

Illustration · not connected to your accounts

Step 4 of 7

4. Mount React Islands cleanly with client:visible or client:idle

Use client:visible for calculators, pricing toggles, and forms below the fold (0 KB React downloaded until scrolled near).

Open full instructions
Example preview04
4. Mount React Islands cleanly with client:visible or client:idle
01Read instructions
02Review staging changes
03Verify before cutover

Illustration · not connected to your accounts

Step 5 of 7

5. Guard window, document & localStorage for build-time pre-rendering

Check converted .tsx files for top-level window.*, document.*, or localStorage calls during component render.

Open full instructions
Example preview05
5. Guard window, document & localStorage for build-time pre-rendering
01Read instructions
02Review staging changes
03Verify before cutover

Illustration · not connected to your accounts

Step 6 of 7

6. Verify dist/ bundle separation & deploy free on Cloudflare Pages

Run npm run build and inspect dist/ to confirm static pages stay ultra-lean while only Island routes reference client hydration chunks.

Open full instructions
Example preview06
6. Verify dist/ bundle separation & deploy free on Cloudflare Pages
01Read instructions
02Review staging changes
03Verify before cutover

Illustration · not connected to your accounts

Step 7 of 7

Check redirects and rollback

Preserve important URLs, test redirects and review platform-specific risks before switching production.

Review redirect map
Example preview07
Check redirects and rollback
01Map old URLs
02Test redirect status
03Keep rollback ready

Illustration · not connected to your accounts

Hidden costs you leave behind

  • Shipping 150-400 KB of React, router, and hydration JS for brochure pages that never change in the browser
  • Paying serverless/compute or PaaS seat fees to serve pages that could be pre-rendered HTML at Cloudflare Edge
  • SEO delays and empty initial HTML trees (<div id="root"></div>) on pure client-rendered SPAs
  • Upgrade friction across full-stack React meta-frameworks just to host a 5-25 page business website

What you gain immediately

  • First-class @astrojs/react integration: drop existing .tsx components directly into .astro pages without rewriting business logic
  • Zero client-side JavaScript (0 KB JS) across all static routes — only Island pages load React
  • Targeted hydration directives (client:visible, client:idle, client:load) minimize main-thread blocking
  • Free global deployment on Cloudflare Pages (dist/ output) with zero Node.js server to patch or pay for

ZERO-DOWNTIME MIGRATION & DNS CUTOVER

Safe 5-Stage Launch & 14-Day Rollback Sequence

  1. STAGE 1
    Old Site Stays Live

    Export sitemap URLs & download images

  2. STAGE 2
    Test *.pages.dev

    Verify mobile, 404, forms & _redirects

  3. STAGE 3
    Lock Email DNS

    Confirm MX, SPF, DKIM, DMARC match

  4. STAGE 4
    Switch Domain

    Attach apex + www. Verify HTTPS & mail

  5. STAGE 5
    14-Day Safety Net

    Keep old host active 14d, then cancel rent

ROLLBACK GUARANTEE:Never delete React / v0 / Bolt on launch day — wait 14 days so rollback is one DNS toggle away.

LIVE HYDRATED REACT ISLAND · client:visible

Convert React SPAs to static Astro + selective React Islands

This interactive workbench itself is a real .tsx React 19 component hydrated inside static Astro HTML via @astrojs/react. Switch presets or adjust controls below to inspect how the island boundary works without shipping React everywhere else on staticlaunch.com.

Shell: 0 KB JSIsland: client:visible
Pattern breakdown · Lovable / v0 / Bolt React SPA

Lovable and v0 ship an entire marketing page inside createRoot(). Move 90% of the page into BaseLayout.astro, and keep only the interactive pricing switch or filter bar as a React Island.

BEFORE · ALL-JS BUNDLE

168 KB+ gzipped JS across every route

AFTER · STATIC SHELL + ISLAND

0 KB JS for Nav, Hero, Copy, Pricing Cards & Footer. Selective client:visible hydration on 1 interactive widget.

Stays static in .astro (0 KB JS)
  • Sticky navigation, hero headline & SEO metadata
  • Service cards, testimonials, FAQ accordion (<details>) & footer
Hydrated in .tsx Island
  • Monthly / Annual billing switch & live savings state
  • Interactive ROI slider or multi-step quote widget
Live React State Preview
5-yr savings on Cloudflare Pages ($0/mo)$2,160
3-yr hosting saved · 1 selective island(s)$1,296
---
import BaseLayout from "../layouts/BaseLayout.astro";
import PricingToggleIsland from "../components/PricingToggleIsland.tsx";
---
<BaseLayout title="Acme Trades" description="Zero-lock-in services">
  <!-- 0 KB JS static HTML rendered at build time -->
  <section class="hero">
    <h1>Licensed Plumbing &amp; Heating</h1>
    <p>Upfront flat-rate pricing before we turn a wrench.</p>
  </section>

  <!-- React hydrates ONLY when scrolled into view -->
  <PricingToggleIsland client:visible />
</BaseLayout>

1. Split your React component tree: static chrome vs stateful Islands

  • Static layout (Navbar, Hero, Feature cards, Pricing matrix, Testimonials, FAQ <details>, Footer) becomes plain .astro components with 0 KB browser JS.
  • Stateful widgets (interactive ROI calculators, multi-step quote estimators, live filterable pricing switches) remain untouched inside src/components/*Island.tsx.
  • Typical marketing and business sites drop 80-95% of client JavaScript immediately using this split.

2. Add @astrojs/react while preserving output: 'static'

  • Run npx astro add react inside your Astro project (installs @astrojs/react, react, and react-dom).
  • Keep output: 'static' and trailingSlash: 'always' in astro.config.mjs so every route compiles to static files inside dist/.
  • Commit package-lock.json cleanly so Cloudflare Pages builds deterministically with npm ci.
Add @astrojs/react integration
npm install @astrojs/react react react-dom
# astro.config.mjs: import react from '@astrojs/react'; integrations: [react()]

3. Replace react-router-dom with file-based Astro pages

  • Move /about, /services, /pricing, and /estimate into src/pages/*.astro wrapped in shared BaseLayout.astro.
  • Replace client-side router <Link> tags with standard semantic <a href="/.../"> elements for instant prefetching and native back-button behavior.
  • Emit page-specific canonical links, Open Graph tags, and Schema.org JSON-LD statically at build time.

4. Mount React Islands cleanly with client:visible or client:idle

  • Use client:visible for calculators, pricing toggles, and forms below the fold (0 KB React downloaded until scrolled near).
  • Use client:idle for non-urgent interactive headers or drawers after first paint finishes.
  • Pass serializable configuration props (JSON numbers, strings, arrays) directly from .astro server frontmatter to React props.
Mount selective React Island
---
import PricingToggleIsland from '../components/PricingToggleIsland.tsx';
---
<PricingToggleIsland client:visible initialMonthly={36} />

5. Guard window, document & localStorage for build-time pre-rendering

  • Check converted .tsx files for top-level window.*, document.*, or localStorage calls during component render.
  • Move browser-only reads safely inside useEffect(() => { ... }, []) or event handlers (onClick / onChange).
  • Never wrap the entire page inside <App client:only="react" /> — keep static copy in Astro so HTML renders cleanly even before hydration.

6. Verify dist/ bundle separation & deploy free on Cloudflare Pages

  • Run npm run build and inspect dist/ to confirm static pages stay ultra-lean while only Island routes reference client hydration chunks.
  • Download the free StaticLaunch React Islands Starter ZIP below or from /templates/ to inspect a complete working example.
  • Connect your GitHub repository to Cloudflare Pages (build: npm run build, output: dist) and enjoy zero hosting fees.
Check non-island static pages
npm run build && grep -L "astro-island" dist/*/index.html | head -n 5

Example 301 redirect map (public/_redirects)

Cloudflare Pages natively executes 301 redirects from public/_redirects at the edge before your HTML is even served.

public/_redirects
/app /estimate/ 301
/pricing.html /estimate/ 301
/components/* /templates/ 301

Critical React / v0 / Bolt gotchas to avoid

  • Bare window or localStorage reads outside useEffect() crash static pre-rendering during npm run build because Astro SSR renders the initial HTML snapshot in Node.
  • Do not export giant UI kits or client-side animation libraries if CSS already solves the visual behavior — keep Islands lean and purposeful.
  • Using @astrojs/react adds React runtime ONLY to pages that actually render a client:* component; every other page still ships 0 KB JavaScript.

CLOUDFLARE TURNSTILE PROTECTED · FOUR MEDIA GROUP

Want Four Media Group to migrate your React / v0 / Bolt site for you?

Every step above is free to run yourself. If you would rather have Four Media Group export your React / v0 / Bolt pages, rebuild cleanly in Astro, map every 301 redirect, and execute a zero-downtime DNS cutover in your own accounts, send your site below.

Visit FOURAK Directly ↗