import { useState } from 'react'; function App() { const [clickCount,setClickCount]= useState(0); const [alertStatus,setAlertStatus]= useState("aus"); //const [sum,setSum]=useState(0); const handleButtonClick = () =>{ const newClick = clickCount +1; setClickCount(newClick); if(newClick % 5 === 0){ setAlertStatus("an"); //alert("Fünf mal geklickt"); }else{ setAlertStatus("aus"); } }; // const handleFive = ()=>{ // setSum(prevsum => prevsum +5); // }; // const handleTen = ()=>{ // setSum(prevsum => prevsum +10); // }; // // //
Summe: {sum}
return ( <>
Alert steht auf {alertStatus}
); } export default App;