Loading workspace environment...
Get started with React syntax, structure, and writing your first program.
// React 19 Interactive Sandbox
import React, { useState } from 'react';
export default function CounterApp() {
const [count, setCount] = useState(0);
return (
<div style={{ fontFamily: 'system-ui, sans-serif', padding: '2rem', textAlign: 'center' }}>
<h2>React 19 State & Effects</h2>
<p style={{ fontSize: '1.25rem', fontWeight: 'bold' }}>Current Count: {count}</p>
<div style={{ display: 'flex', gap: '0.5rem', justifyContent: 'center' }}>
<button onClick={() => setCount(c => c + 1)} style={{ padding: '8px 16px', background: '#0284c7', color: '#fff', border: 'none', borderRadius: '6px' }}>Increment</button>
<button onClick={() => setCount(0)} style={{ padding: '8px 16px', background: '#e2e8f0', border: 'none', borderRadius: '6px' }}>Reset</button>
</div>
</div>
);
}