When are functional updates required for computations involving previous state?
问题 According to the documentation for the useState React Hook: If the new state is computed using the previous state, you can pass a function to setState . The function will receive the previous value, and return an updated value. So given const [count, setCount] = useState(initialCount); you can write setCount(prevCount => prevCount + 1); I understand the reason for using the updater function form with setState , as multiple calls may be batched. However During subsequent re-renders, the first