Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
# 1. Scaffold a new React app using Vite npm create vite@latest my-app -- --template react # 2. Install dependencies cd my-app npm install # 3. Start the dev server (http://localhost:5173) npm run dev # 4. Build for production npm run build # ── Generated file: index.html ──────────────────────────────── # <!DOCTYPE html> # <html lang="en"> # <head><meta charset="UTF-8" /><title>My App</title></head> # <body> # <div id="root"></div> # <script type="module" src="/src/main.jsx"></script> # </body> # </html> // ── src/main.jsx ────────────────────────────────────────────── import React from 'react'; import ReactDOM from 'react-dom/client'; import App from './App'; import './index.css'; ReactDOM.createRoot(document.getElementById('root')).render( <React.StrictMode> <App /> </React.StrictMode> ); // ── src/App.jsx ─────────────────────────────────────────────── function App() { return <h1>Hello, Vite + React!</h1>; } export default App;
Result
Open