Web Components are gaining momentum in the web platform space, and frankly, it’s bittersweet for us ASP.NET Core developers. On the one hand, you can use Web Components in your current ASP.NET Core applications, as I demonstrated in a previous post, but it isn’t the best experience it could be. You’ll have flashes of unstyled content, layout shifts, JavaScript code that blocks the critical rendering path, and you’ll not get the server-side rendering (SSR) goodness developed exclusively for the JavaScript ecosystem.
In his post “THE GOOD, THE BAD, THE WEB COMPONENTS”, Zach Leatherman wrote about the ideal way to deliver web components to avoid some of the issues I described. In this blog post, we’ll see how we can use ASP.NET Core’s Tag Helpers to deliver the best experience to users when using Web Components.