Styled Components
Learn how to style components rather than each tag individually.
We'll cover the following
Consistent CSS
If we want the style for a particular element to be consistent everywhere we use it, another option is to create a styled component. This is where we create a new reusable React component for the sole purpose of giving it a fixed style. We would use our custom-styled element that has the style we want already applied to it. In lines 34-40, we do that for our Edit
and Delete
buttons by creating a styled component called Button
(with a capital “B”).
Get hands-on with 1400+ tech skills courses.