High-Performance State Updates
State represents the dynamic aspect of your React application. When the state changes, your components react to those changes. Without state, you would have nothing more than a fancy HTML template language. Usually, the time required to perform a state update and have the changes rendered on the screen is barely, if at all, noticeable. However, there are times that complex state changes can lead to noticeable lag for your users. The goal of this chapter is to address these cases and find out how we can avoid those lags.
In this chapter, you’ll learn how to do the following:
- Batch your state changes together for minimal re-rendering
- Prioritize state updates to render content that’s critical for your user experience first
- Develop strategies for performing asynchronous actions while batching and prioritizing state updates