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);
//  };


//  <button onClick={handleFive} >+5</button>
//  <button onClick={handleTen} >+10</button>
//  <div>Summe: {sum}</div>

  return (
    <>
    <button onClick={handleButtonClick} >klick mich</button>
    <div>Alert steht auf {alertStatus}</div>
 
    </>
  );
}

export default App;
