This is one of the most basic things in React but I wonder why counter+1 is working, but in counter++ you must double click to increase the number?
import React, { useState } from "react";
import "./App.css";
function App() {
  const [counter, setCounter] = useState(0);
  const counterHandler = () => {
    setCounter(counter + 1);
  };
  return (
    <div className="App">
      {counter}
      <button onClick={counterHandler}>Increment</button>
    </div>
  );
}
export default App;
 
     
    