@@ -1,6 +1,12 @@-import React from "react";+import React, { useState } from "react"; -const Counter = () => {- return <div>0</div>;-};+const Counter = () => {+ const [count, setCount] = useState(0);+ return (+ <div>+ <button onClick={() => setCount(count + 1)}>+</button>+ <span>{count}</span>+ <button onClick={() => setCount(count - 1)}>-</button>+ </div>+ );+}; export default Counter;
@@ -7,6 +7,8 @@ import Counter from "./components/Counter"; function App() { return ( <div> <h1>My App</h1>+ <Counter /> </div> ); }