DEV Community

Manav Misra
Manav Misra

Posted on

Answer: TailwindCSS classes not able to be chosen with variables with React

I was facing issue when receiving a dynamic color prop that was going to be used as: className={rounded px-4 py-2 text-white bg-${bgColor}-500} in the component.

It was not working properly essentially due to naivety of PurgeCSS.

We have to use a safelist option as per the docs

Top comments (0)