I'm using the dynamic import()
syntax to split each route component into a separate bundle and React.lazy
to load the components only when they are required. I have a PageLoading
component which serves as the fallback content for <React.Suspense />
.
Is it possible to keep the current view component mounted until the "lazy loaded" component is ready to be rendered? The bundles are quite small individually so inevitably the page just ends up flashing for less than half a second while the "fallback" is rendered.
Thank you.
Edit: I am not looking to create an artificial delay. What am I asking for is exactly as I have described.