Controlled Counter
React
Junior
State managementEvent handlers
Create a Counter component with internal count state starting at 0, displayed on screen.Requirements
- A "+" button increases
countby 1 per click. - A "–" button decreases
countby 1 per click.
Note
- Do not edit
data-testidattributes: they are used for testing.
import Counter from "./Counter"; export default function App() { return ( <div className="min-h-screen bg-gray-50 p-4 flex justify-center"> <Counter /> </div> ); }
JavaScript Console
console.log()statements will appear here
Tests
AI Analyzer