JSFiddle - React, Tailwind, and code Playground
HTML
<div class ="numeric"></div>
SCSS
.numeric {
&.one {
color; #FF0040;
}
&.two {
color; #FFA243;
}
&.three {
color; #63ff00;
}
}
JavaScript
const nrClass = {
'3': 'three',
'2': 'two',
'1': 'one'
}
const blah = number=>{
const elem = document.getElementsByClassName("numeric")[0];
elem.innerHTML = number;
console.log(nrClass[number])
elem.classList.add(nrClass[number]);
}
//blah(1);
//blah(2);
blah(3);