fgerschau / comments

1 stars 0 forks source link

react-lazy-loading-components/ #26

Open utterances-bot opened 1 year ago

utterances-bot commented 1 year ago

Lazy loading React components with React.lazy | Felix Gerschau

Learn how to improve performance by reducing the bundle size of your application.

https://felixgerschau.com/react-lazy-loading-components/

RubenGarciaBri commented 1 year ago

Great article Felix, thanks a lot for sharing. Just 2 little remarks: -In step 1, isn't the correct syntax: export { default as MyComponent } instead of export { MyComponent as default }... -In the first line of the Error Handling section you wrote: "It an happen that...", so just a little typo

fgerschau commented 1 year ago

Thanks, @RubenGarciaBri! I updated the article to fix these typos

AndrewSmir commented 1 year ago

There's one more way to use named exports with React.lazy:

const LazyComponent = lazy(
    () => import('./components)
        .then(module => ({ default: module.Component }))
);
zero-one-developer commented 1 year ago

thanks bro