Answer the question
In order to leave comments, you need to log in
How to assign different classes to elements of the same type, depending on the number?
I have a component that stores data, which in turn stores post objects. Posts have a number of stars (key: value). I need to make it so that depending on the value, the number of stars is displayed.
Let's say 4 stars, then it is displayed (fas classes are shaded, and far are not shaded):
<i class="fas fa-star"/>
<i class="fas fa-star"/>
<i class="fas fa-star"/>
<i class="fas fa-star"/>
<i class="far fa-star"/>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question