Publish React (JSX) and Tailwind Code from AI as One HTML File
You don’t need a compiler, Node.js or a build step. When Claude, ChatGPT, v0 or Lovable hands you a React component with Tailwind classes, wrap it in one HTML file that loads React, Babel and Tailwind from a CDN. Hostilo then publishes it like any other page, with an HTTPS link.
How to tell you got React and not HTML
A browser opens HTML files. A React component is source code that has to be translated first. You are looking at React when you see:
import React from 'react'orexport default function App()at the top;className=where HTML would haveclass=;- tags that start with a capital letter, such as
<Card>or<Button>; - a file name like
App.jsx,App.tsxorpage.tsx.
Pasted into any host as it is, this code gives a blank page or shows up as text. It is one of the most common reasons an AI page won’t work online. We cover the others in Why your AI website won’t go live.
The quickest way: ask the AI to convert it
Send this in the same chat, right after the component:
Turn this React component into one self-contained index.html file that runs in the browser without a build step:
- load React 18.3.1 and ReactDOM 18.3.1 (UMD builds from unpkg), @babel/standalone and Tailwind (@tailwindcss/browser@4) from a CDN;
- put the component in <script type="text/babel">;
- remove import and export lines and TypeScript types, take hooks from React (const { useState, useEffect } = React);
- put components imported from @/components into the same file;
- render the main component into <div id="root">.
Reply with the complete file only.
You get back one index.html. In Hostilo, create a site, paste the code into the editor and press Save. If Hostilo is connected to Claude or ChatGPT, add “and publish it on Hostilo as my-app” to the request and the link arrives in the reply.
Or do it by hand with our template
Copy the template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Luna Café</title>
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4.1.11"></script>
<script src="https://unpkg.com/react@18.3.1/umd/react.production.min.js"></script>
<script src="https://unpkg.com/react-dom@18.3.1/umd/react-dom.production.min.js"></script>
<script src="https://unpkg.com/@babel/standalone@7.26.4/babel.min.js"></script>
</head>
<body class="bg-stone-50">
<div id="root"></div>
<script type="text/babel">
const { useState, useEffect } = React;
// Your component goes here (without import and export lines)
function App() {
const [count, setCount] = useState(0);
return (
<main className="min-h-screen flex flex-col items-center justify-center gap-6 p-8">
<h1 className="text-4xl font-bold text-stone-800">Luna Café</h1>
<p className="text-stone-600">Coffee ordered today: {count}</p>
<button onClick={() => setCount(count + 1)}
className="rounded-xl bg-amber-600 px-6 py-3 font-semibold text-white hover:bg-amber-700">
Order a coffee
</button>
</main>
);
}
ReactDOM.createRoot(document.getElementById('root')).render(<App />);
</script>
</body>
</html>
We tested it on November 29, 2026 with React 18.3.1, Babel standalone 7.26.4 and the browser build of Tailwind 4.1.11. The fixed version numbers are deliberate: a new release of a library won’t change your page overnight.
Swap in your component
Replace the example App with your code. Delete the import lines and change export default function App() to function App(). If your component uses other hooks, such as useRef, add them to the first line. If the main component has a different name, change it in the last line too. Code in TypeScript (.tsx) needs its types removed; the AI does that in a few seconds.
Publish
In Hostilo, create a site, paste the file and press Save. The page works at name.hostilo.page. If it stays blank, press F12 and open the Console tab: the error names the line that failed.
Components with imports (icons, React 19)
If the component imports packages, for example icons from lucide-react, the browser can load them as modules from esm.sh. An import map tells it where each package lives, and your code keeps its import lines:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>My app</title>
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4.1.11"></script>
<script type="importmap">
{
"imports": {
"react": "https://esm.sh/react@19.1.0",
"react-dom/client": "https://esm.sh/react-dom@19.1.0/client",
"lucide-react": "https://esm.sh/lucide-react@0.511.0?external=react"
}
}
</script>
<script src="https://unpkg.com/@babel/standalone@7.26.4/babel.min.js"></script>
</head>
<body>
<div id="root"></div>
<script type="text/babel" data-type="module" data-presets="react">
import React, { useState } from 'react';
import { createRoot } from 'react-dom/client';
import { Coffee } from 'lucide-react';
export default function App() {
const [n, setN] = useState(0);
return (
<main className="p-10 text-center">
<Coffee className="mx-auto h-10 w-10 text-amber-600" />
<h1 className="text-3xl font-bold">Orders: {n}</h1>
<button className="mt-4 rounded bg-black px-4 py-2 text-white"
onClick={() => setN(n + 1)}>+1</button>
</main>
);
}
createRoot(document.getElementById('root')).render(<App />);
</script>
</body>
</html>
Two details matter here. Keep import React at the top, because Babel turns every tag into React.createElement. And add every package the code imports to the import map. Packages written for Node.js or a server won’t run in a browser.
@/componentsImports that start with @/ point to files in the author’s project, not to packages. Ask the AI to move those components into the same file. The prompt above already does it.
What works and what doesn’t
| Works in one HTML file | Needs a server or a build |
|---|---|
State and effects (useState, useEffect), your own components | Next.js features: server components, API routes, next/image, routing in app/ and pages/ |
Tailwind classes, including hover:, md: and dark: | Secret API keys. Anyone can read the page code, so never put a key in it |
| Animations, icons and charts from packages built for the browser | Databases and sign-in written for Node.js |
| A contact form through Hostilo forms (50 messages a month on the free plan) | Packages that read files or use Node.js modules |
Is it fast enough?
For a prototype, a game, a calculator or a page for a small group: yes. Keep in mind what each visitor downloads. Babel alone is about 3 MB (about 630 KB compressed), Tailwind for the browser about 260 KB (65 KB compressed), and the visitor’s browser compiles your component on every visit. On a laptop you won’t notice. On an older phone the page can appear a second or two later.
Tailwind’s documentation describes the browser build as a tool for development rather than production. For a company page that should load quickly and do well in Google, pick one of the other two routes below.
Which route to pick
| Your situation | Route |
|---|---|
| One component from a chat: a tool, a game, a prototype | The template or the prompt above |
| A landing page or a company website | Ask the AI: “Rewrite this as plain HTML and CSS, without React and without the Tailwind CDN.” The page loads fastest. More prompts in The best AI prompts for single-file websites |
A whole project from v0, Lovable or Bolt, with a package.json | Build it once: npm install, npm run build, then zip the dist folder and upload the ZIP to Hostilo (up to 20 MB and 300 files). This needs Node.js on your computer. See Publish a multi-file website |
Frequently asked questions
Do I need Node.js?
No. The template and the prompt work without it. You only need Node.js to build a whole project with a package.json.
Why is my page blank?
Most often an import or export default line is still there, or the component name in the last line doesn’t match. Press F12 and open the Console tab: the error shows the line.
Do the files from the CDN count towards my storage?
No. React, Babel and Tailwind load from unpkg and jsDelivr. Your site stores only your HTML file, and the free plan has 50 MB.
Will Google index a React page like this?
Google can render JavaScript, but plain HTML gets indexed faster and more reliably. For a page people should find in search, ask the AI for plain HTML and CSS.
Put your React component online
Create a free account, paste the HTML file into the editor and get an HTTPS link. No credit card needed.
Start free

