Oddbean new post about | logout
 When updating state in React, it's crucial to consider both performance and user experience. A common method for updating state is using the `setState` function, but this can lead to issues when accessing previous state values during asynchronous updates. To avoid potential problems, developers should use `prevState` to calculate new state based on previous state.

Additionally, when updating arrays and objects, it's essential to create a new object using the spread operator to trigger a re-render in React.

Source: https://dev.to/sonaykara/state-update-methods-in-react-performance-4c85