Adding Web components to a Blazor site
We have looked at adding Blazor to an existing Angular, React, and even MVC/Razor pages site.
But sometimes that perfect library that you love to use might not have a Blazor counterpart. We know that we can make JavaScript interop and build it ourselves, but can we also use Angular and React libraries from Blazor?
We have two options here, either we can convert our site to an Angular/React site and use those examples, or we can convert the JavaScript library to a Web Component and use that from Blazor.
Up until now, we haven’t used any NPM or anything like that because in most cases we don’t need it.
But now we are mixing technologies and for that NPM is the easiest way.
NPM is outside the scope of this book so I will not go into any details about NPM.
How to convert Angular/React or something else to a Web Component is also outside the scope of this book.
The project is called BlazorProject
.
We can browse some of the Web Components...