Question is specifically related to functional components only
[state, setState] = useState(0);
// 1st way to increment by one
setState(state + 1);
// 2nd way to increment by one
setState((prevState) => prevState + 1);
What is the need for the second way? Is there any use case for that can only be met using the 2nd format? Is there any case where state !== prevState inside setState?