I’m working on a React application, using Tailwind for styling. This issue happens when I’ve been developing for a while. For example, I add a container with hover:bg-red-900
, and it works at first, but for some reason, that specific style stops working. Then if I change it from 900
to 800
, it works fine, but if I switch back to 900
, it gets ‘stuck’ in the error.
I’m not sure if the problem is related to caching, memory, or something else. But it’s frustrating, and it doesn’t let me continue comfortably.
To fix the error, I have to use inline styles or create a .css file… When it really shouldn’t be necessary.
2
Answers
Okay, apparently I found my mistake, and it wasn't directly an issue with Tailwind, caching, or memory, but with state management.
To show certain styles conditionally, I was using calculations inside the Template String, and I changed it to state, which is calculated in a useEffect. Now the behavior is as expected.
Thanks!
Apply path in tailwind config file.