Let say the primary color of every button is bg-gray-600 and i wanted to change it to bg-indigo-600. I tried using the template literals but it has no effect on UI.
const mycomponent = () => {
const [color, setColor] = useState('blue');
return (
<>
<button
onClick={() => {
setColor('gray');
}}
>
Change color to gray
</button>{' '}
<div className={`bg-${color}-600 p-2`}> Hello world </div>{' '}
</>
);
};
The above code did changed the class but the color didnt changed, however when apply the class bg-gray-600 as it is without the template strings , then it works, what am i missing?