gregberge / loadable-components

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

How to load a component with children? #924

Closed rostero1 closed 2 years ago

rostero1 commented 2 years ago

💬 Questions and Help

How do I load a component with children attached to it, like Tabs.Panels?

Here's the export on the component: export let Tab = Object.assign(TabRoot, { Group: Tabs, List, Panels, Panel })

Also, probably a dumb question, but if I import a component that imports huge_node_module and then another that also imports the same huge_node_module, will huge_node_module be loaded twice?

theKashey commented 2 years ago

For such case you should use "library" adapter - https://loadable-components.com/docs/library-splitting/