Example
const [count, setCount] = useState(0);
return (
<main>
<button onClick={() => setCount(count + 1)}>
Click me
</button>
<button onClick={() => setCount(test => test + 1)}>
Click me
</button>
<p>{count}</p>
</main>
)}
The result is the same. The number is always incremented by one when clicked. But I don't understand why the arrow function is used. Thank you