Austin Gil
Apr 9, 2021

--

Hey Dmitry, that’s a good question. It comes down to the same reason you may need a component in general. If you have a lot of markup that gets repeated in many places, you can abstract that into a single place. That makes maintaining consistency or making changes easier.

For your example, it doesn’t make sense if you just have a simple <li>. But often times, a “card” component is quite a lot of markup. Unfortunately there isn’t any rule that applies to every situation. You’ll have to develop the experience to know when you want to break things out into their own components.

--

--

Austin Gil
Austin Gil

Written by Austin Gil

I want to help you build better websites. I create cool stuff for the web and share what I learn.

Responses (1)