Code
Output
VS Code
Run
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
// A React component. Edit it and press Run. import { useState } from "react"; export default function Counter() { const [count, setCount] = useState(0); return ( <div style={{ fontFamily: "system-ui", padding: 24, textAlign: "center" }}> <h2>You clicked {count} time{count === 1 ? "" : "s"}</h2> <button onClick={() => setCount(count + 1)} style={{ fontSize: 16, padding: "10px 22px", borderRadius: 10, border: 0, background: "#f97316", color: "white", cursor: "pointer", }} > Click me </button> </div> ); }
Output
Loading runtime…
Ready when you are
Edit the code, then press Run (or ⌘/Ctrl+Enter) to see it here.
Console
Console output appears here…