gregberge / loadable-components

The recommended Code Splitting library for React ✂️✨
https://loadable-components.com
MIT License
7.7k stars 382 forks source link

Fallback behaviour #977

Open matteobaldini opened 1 year ago

matteobaldini commented 1 year ago

Hello! I'm not sure how to use fallback with delay as described in this doc: https://loadable-components.com/docs/delay/.

Given something like: <Route exact path="/product/books" component={loadable(() => pMinDelay(import("views/books", { fallback: <div>loading ...</div> }), 10000))} />

The way it works when implemented is:

What's the correct way to obtain the following:

Thanks!

theKashey commented 1 year ago

Looking at pMinDelay implementation it should work exactly like this. Could it be that the loader is displayed by the component rendered by the Route, not loadable?