React.lazy() vs React Loadable
No, React Loadable should not be used anymore, because it is not being maintained.
It used to be the recommended way for lazy loading when rendering on the server side, while React.lazy only works on the client side.
The React team now recommends another library for server side rendering.
Quote from the React documentation:
Note:
React.lazy
and Suspense is not yet available for server-side rendering. If you want to do code-splitting in a server rendered app, we still recommend Loadable Components. It has a nice guide for bundle splitting with server-side rendering.
If you're doing SSR
you'll want to consider using Loadable
instead of React.lazy
, as suggested by the official React.lazy
docs:
React.lazy and Suspense are not yet available for server-side rendering. If you want to do code-splitting in a server rendered app, we recommend Loadable Components. It has a nice guide for bundle splitting with server-side rendering.