Firstly, this is my code:
<div className="phone" style="--bg: var(--green)">
But the error is like:
Error: The
styleprop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX.
so I change my code into
<div className="phone" style={{--bg: var(--green)}}>
<div className="name">So dien thoai</div>
</div>
<div className="fb" style={{--bg: var(--blue)}}>
<div className="name">Facebook</div>
</div>
<div className="gg" style={{--bg: var(--red)}}>
<div className="name">Google</div>
</div>
:root{
--red: #ee4d2d;
--blue: #0288d1;
--green: #6cc942;
}
.phone, .fb, .gg{
display: flex;
padding: 4px 0;
border: 1px solid black;
background: var(--bg);
.name{
padding-left: 20px;
}
}
They told me i can't use --bg in style={{ }}