impor React, { useState } from "react"; const Counter = () => { const [count, setCount] = useState(0); const onCountUp = () => { setCount(count + 1); } const onCountDown = () => { setCount(count - 1); } return( <> count: {count} button onClick={onCountUp}>UP/button> button onClick={onCountDown}>DOWN/button> > ); } export defaul Button;
import React from "react"; import Button from "components/Counter"; const App = () => { <> Counter /> > } export default App;