gioboa / react-microfrontend-demo

React+Vite with Module Federation is now possible
23 stars 6 forks source link

fix: move lazy outside the render body #6

Closed kandros closed 1 month ago

kandros commented 1 month ago

By calling lazy inside the component body it tries to load It on every render causing remounting and suspense to trigger loading state again.

In this demo is not a problem cause the host doesn't rerender but It might be a cause of confusion

Before

https://github.com/user-attachments/assets/8f119bda-a9c0-4bf7-8645-b93e96c1ba2a

After

https://github.com/user-attachments/assets/8286f18c-a900-4ef4-9f5b-fe72370e9553