react-imported-component
react-imported-component copied to clipboard
LazyBoundry fallback doest not work with react-router-dom
Hi, I have a problem with LazyBoundry component and its fallback property.
Here is example code:
I am switching the page and LazyBoundry fallback does not display anything. Should I use it in some other way? On client we are using BrowserRouter on SSR StaticRouter
I as far I remember it was working that way with the standard Suspense component when I didn't have SSR implemented.
Thanks
Right now LazyBondary is Suspense - https://github.com/theKashey/react-imported-component/blob/03165dc83ac95e734ba4bfdf927a15b48095f6df/src/ui/LazyBoundary.tsx#L11
However, there is a yet unresolved issue - https://github.com/theKashey/react-imported-component/issues/202 - which is needed to support SSR+React > 16.9. The issue is around React "knows" that you can not use Suspense on the server, and breaks if you hydrate, because 🤔 you cannot use Suspense so we will not let you do it.
Look like for how the simplest way to mitigate the issue with Suspense is to use React < 16.10. For example, everything confirmed to work perfectly with 16.9.