Introduction to DOM Elements and Polymorphic Components
Explore extending standard DOM elements and creating polymorphic components in TypeScript. This lesson helps you build flexible, reusable components that maintain type safety and adapt to different HTML elements dynamically.
We'll cover the following...
Component abstraction
In most of the larger applications and projects we’ve worked on, we often build many supersets or abstraction components on top of the standard HTML elements. Some examples include custom button elements that might take a prop defining whether or not that button should be primary or secondary, or maybe one that indicates that it will invoke a dangerous action, such as deleting or removing an item from the database. We still want our button to have all the properties of a button and the props we want to add to it.
Another ...