DEV Community

Discussion on: What are micro frontends?

Collapse
 
jwhenry3 profile image
Justin Henry

Might I suggest for those wanting to move in the direction of MicroFrontend look at building separately compiled npm packages with shared dependencies using project templates in order to strategically plan a migration strategy for legacy apps.

I am currently in progress with this in my day-job and it's working out great. I am migrating a monolithic Angular app to React, so I am building libraries (collections of React components) that contain a single feature and/or related pieces in order to segregate the purposes of a given application. This allows me to include them in the shell app (the monolith) as an npm dependency and then later, at my choosing, move the npm dependencies to webpack federation or another means to remotely host and version them to lazy load them at runtime.

It's a stepping stone to MicroFrontend, but it certainly enforces the same patterns and ideas without the immense burden of using single-spa or another MicroFrontend tool. The great thing about React is you can just use ReactDOM.render() in order to render the precompiled components you want within an Angular (or whatever framework) component with lifecycle hooks to ensure proper creation, update, and garbage collection.