This is DOM applying Sass.
<i className={`contract-icon ic-${this.props.value}`} />
This is Sass file.
.contract-icon {
&.ic-rise_fall {
&:before {
content: url('../images/trading_app/contracts/rise_fall.svg');
}
&--invert:before { # What's this?
content: url('../images/trading_app/contracts/invert/rise_fall.svg');
}
}
.other-class {
padding-right: 8px;
}
...
Based on my research,
&
is combine/ join with this selector if the current element has the accompanying class applied.- (My Guess) So I thought we can build DOMs like this way:
<div class="contract-icon> <div class="ic-rise_fall">
-> But this is not right. Why is it wrong? How does it make a difference from.contract-icon
class?
- (My Guess) So I thought we can build DOMs like this way:
(Bonus Question) What is
--invert:before
?