by domenicd · 3y ago · 0 comments
SPAs can get this sort of thing too, but it's less automatic and generally requires framework support for keeping track of chunks of not-yet-visible, non-user-interactable inert DOM and matching them up with link clicks. Whereas with MPAs, because you're using the standard page rendering and link paradigm, the browser can manage for you.
Source: engineer on Chrome working on this feature :)
I recall Opera doing this sort of thing around two decades ago. It had a setting to aggressively cash all links, and navigating between those was instantaneously.
Is this what Chrome does?
Do you know of a React library for doing this? tanstack react-query can prefetch [0] but it just prefetches a REST API, it doesn't prerender in an invisible DOM node or something (also "prerendering" in React usually refer to server-side rendering of HTML text, not to prerendering something in the browser, so this seems a bit hard to search for)
[0] https://tanstack.com/query/latest/docs/react/guides/prefetch...