Chapter 10: Code Splitting Using Lazy Components and Suspense
Code splitting has been happening in React applications for some time now, long before there was any official support in the React API. With the latest version of React, there are new APIs that we can use that directly support code-splitting scenarios. Code splitting is necessary when you have larger applications with a lot of JavaScript code that must be delivered to a browser.
Big monolithic JavaScript bundles that house an entire application can create usability issues on initial page loads due to longer load times. With code splitting, we have more fine-grained control over how code makes its way from the server to the browser. This means more opportunities for us to properly handle load-time User Experience (UX).
In this chapter, you'll learn how to do this in your React applications by using the lazy()
API and the Suspense components, two recent additions to React. Once you understand how these two pieces...