React Core & Hooks (407 Qs)•Part 8: Advanced React Patterns, Portals & Performance (152 - 261)
What are loadable components?
junior LevelCode ExampleComponentsFormsPerformance
Loadable Components (@loadable/component) is a code-splitting library for React that supports Server-Side Rendering (SSR). While React.lazy was originally designed for client-side rendering, Loadable Components allows dynamic chunk imports with full SSR support, preloading capabilities, and automatic script collection for hydration.
jsx
import loadable from '@loadable/component';
const OtherComponent = loadable(() => import('./OtherComponent'), {
fallback: <div>Loading...</div>,
});
function MyComponent() {
return <OtherComponent />;
}