2019-11-29
Prefetch lazy-loaded component
react, devjournal, selfnote
react, devjournal, selfnote
Image Credit: Created with the Imgflip Meme Generator
Cory House has posted following tweet today.
https://twitter.com/housecor/status/1200554167644966912
Cory has pointed out a feature in CRA to enable prefetching lazy component, but I learned of a way to apply it on a project.
Suppose that you are building a customer intake site.
When a user receives a call, the user can quickly load up the initial customer page
because the site is small because non-essential code is split (lazy loaded).
Validating user (to confirm that the user has the correct customer's page on) will be the idle time to prefetch the lazy component such as tabs to fill in the customer's information, and modal confirmation boxes, etc.
The typical workflow will be,
So this would especially be effective for LOB (line of business) apps with lots of data to enter or look up.
Ones I can think of are,
Image Credit: Created with the Imgflip Meme Generator