Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.


    Avoid Duplicate id Attributes when Reusing Form Components


    When we reuse components that rely on HTML id attributes, we run the risk of rendering HTML that results in duplicate IDs in the HTML. IDs are meant to be unique and this is problematic when rendering multiple forms, where IDs are used to make the association between labels and inputs. If this association is broken, it leads to unexpected behavior and is an accessibility issue. In this lesson, we'll look at how we can conditionally assign IDs and ensure that we don't render duplicate IDs, even when rendering several instances of the same form component on the page.