LINKDING

Shared bookmarks

Web component gotcha: constructor vs connectedCallback | Read the Tea Leaves

Date added
May 17, 2024, 5:39 a.m.
Description
A common mistake I see in web components is this: This setupLogic() can be just about anything – subscribing to a store, setting up event listeners, etc. The teardownLogic() is designed to undo those things – unsubscribe from a store, remove event listeners, etc. The problem is that constructor is called once, when the component…