Free Online React Playground
Write React components in JSX and see them render live, with console output beside the preview. Uses React 18, so you can try hooks without a build tool.
Press Run, or Ctrl or Cmd + Enter, to run your code. The page shows in Preview and everything you log shows in Console. Use Stop if a script never ends. React 18 and JSX are available: define a component named App, or export one as the default.
Preview
Console
Output appears here. Press Run, then try console.log("Hello")
How to use
Write your component in the App.jsx tab. Define a component named App, or export one as the default.
Add styles in the CSS tab.
Press Run, or Ctrl or Cmd + Enter. Your component renders in Preview, and anything you log appears in Console.
Copy the code, download a zip of your files or clear the editor with the icons above it.
Open the full screen editor for more room, and use the A buttons to resize the text.
Press Format to tidy the tab you are editing, or untick Wrap long lines to scroll sideways instead.
Why use this tool
React 18 and JSX
Write JSX directly. Hooks, state, effects and events work as they do in a normal React app.
React imports
You can import from react, react-dom and react-dom/client, or use the React global that is already loaded.
Preview and console together
See the rendered component and what it logs side by side, with errors shown in red.
Download as a zip
Take your component away as a zip: an HTML page that loads React from a CDN, plus your component and CSS as separate files.
One-click formatting
Tidy the indentation and spacing of the tab you are editing with one click or Shift + Alt + F.
Comfortable editor
Resize the text, switch line wrapping on or off, or go full screen with the editor and preview side by side.
About this tool
Write React components in JSX and see them render live. This online React playground runs React 18, so you can try hooks such as useState and useEffect, test a component idea or learn React with no build tool and no project to set up. Press Run and the component renders in the preview, with everything you log shown in a console beside it. Copy your code, or download a zip with the page and each file.
This React playground lets you write components in JSX and see them render straight away. It uses React 18, so you can try hooks such as useState and useEffect, test a component idea or learn React with no build tool and no project to set up. Press Run and the component renders in the preview, with everything you log shown in a console beside it.
When you are ready, copy your code or download a zip with the page and each file. For plain JavaScript, use the JavaScript Playground, and for Vue use the Vue Playground.
Frequently asked questions
React 18.3, loaded from a public CDN. React 19 no longer ships the browser build this playground relies on, so it stays on 18.
No. Only react, react-dom and react-dom/client can be imported. Any other import shows an error in the Console.
Yes. React and the JSX compiler are loaded from a public CDN the first time you run your code. The compiler is about 3 MB, so the first run can take a moment. Your browser keeps it afterwards.
Define a component named App, or export one as the default. If your code has a mistake, the message appears in the Console.
Not unless you turn on Auto-run, which is off by default. Your code runs when you press Run, or Ctrl or Cmd + Enter. It never runs by itself when the page loads, except the built-in example on a first visit.
Not in this playground. Use the TypeScript Playground to write TypeScript.
Yes. Press Format, or Shift + Alt + F while you are typing, to tidy the tab you are editing. If the code has a syntax error it is left unchanged and the problem is shown under the editor.
Yes. Untick Wrap long lines under the editor and it scrolls sideways instead. Your choice is remembered on this device.
Write a component in JSX and press Run. It renders in the preview and anything you log appears in the console.
Yes. The playground uses React 18, so hooks such as useState and useEffect work.