#Development #Techniques
Bulletproof web component loading · How to ensure they work predictably every time. https://ilo.im/1658l1
_____
#Reliability #Initialization #WebComponents #WebDev #Frontend #DOM #HTML #JavaScript
Bulletproof web component loading
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. <div id="toc"></div>const myTOC = new TableOfContents('#toc'); But with web components, all you need to do is include the custom element associated with the component.