Web components don't need a constructor()
SMRTR summary
Web component development best practices have evolved over time. While many developers traditionally initialized components in the constructor() method, the recommended approach is to use the connectedCallback() method instead. This aligns with the official specification and prevents potential errors in certain scenarios, such as when using Element.replaceWith(). Notably, if a component's constructor() doesn't contain any code, it can be omitted entirely. The super() method is implicitly called when no constructor is defined, simplifying component code and improving efficiency.
SMRTR provides this summary for quick context. The original article belongs to Go Make Things.
Read the original article