More details on the specifics of the API can be referenced here.įor those unfamiliar with code-splitting or dynamically loading modules at runtime, its useful to understand that one of the main purposes is to allow developers to split their codebase into smaller chunks, generally separated by concern, route, or function. Recently, React released version 16.6.3 which gave us support for code-splitting out of the box, although support for server-side rendering is not available and there are other implementations, but for our purposes we are going to use React.lazy and React.Suspense. In this post, I would like to practically show how one can achieve the above with this rather new API.ĭisclaimer: Here I am using React with Webpack but the same can be achieved in Vue as well as Angular and with other bundlers such as parcel.js. In a previous post, I wrote briefly about how the IntersectionObserver API could be used for things such as analytics and dynamic module loading but I didn’t fully provide any concrete examples. Infinite component scrolling with React.lazy and IntersectionObserver
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |