TSX
Basic state management in React functional components
Last updated: 17/01/2026, 17:24:26
Hide Preview
Copy
Edit
123456789101112
Unexpected token '<'
Ask AI for Helpimport { useState } from 'react'
function Counter() {
const [count, setCount] = useState(0)
return (
<div>
<p>Count: {count}</p>
<button onClick={() => setCount(count + 1)}>Increment</button>
</div>
)
}Preview Configuration
Add Parameter
Counter
The name of the function or component to render. Leave empty to use the default export.