Today, I wanted to talk about the “right” way to load web components to ensure they work predictably every time. Let’s dig in! The challenge Web components are self instantiating. Let’s imagine you’re creating a table of contents. When you use a traditional JavaScript library, you explicitly instantiate the library on a specific element.
const myTOC = new TableOfContents('#toc'); But with web components, all you need to do is include the custom element associated with the component.