Use the `attrs` method to add HTML attributes in styled-components

InstructorSara Vieira

Share this video with your friends

Send Tweet

We will learn about the attrs method that allows us to change and add attributes to our styled elements.

We have the two buttons that we made in a previous lesson. We can add .attrs onto our styled.button to be able to add on types. attrs can return an object or a function. We will see the difference between the two and why you would use one over the other.