Hi Cristi, and thanks for the great feedback!

Definetely I should add a warning in my post that Webpack is going to create a chunk for every component. Usually I have my “willing-to-split” components in a different folder so I don’t create unnecessary chunks. Thanks!

However, Webpack may be creating a lot of chunks, but your app will only consume the necessary ones, so you might end up with a “messy” compiled application, but not a less performant one.

Regarding the async code in the component declaration, the main difference here is that you are assuming the name of the component you want to import. Using the pattern of the post you would be able to import components while using a prop. Your approach is quite similar to main second approach, but improved by using code splitting. Which is cool indeed!

Words matter – Software product development, Front-end, UX, design, lean, agile and everything in between. https://afontcu.dev

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store