I asked a while ago about the tailwindCSS TailwindCSS - is there a way to not write multiple times the same prefix? like `hover:` for example
and someone correctly solved the problem but with javascript (for now it seems to work perfectly fine)
but someone in the comment said that using `${className}` is bad.
the line that he talking about is this
element.classList.add(`${pseudo}:${className}`);
// sample output: "hover:bg-blue-500"
at this point, I don't know if is right or not, because at the end of the day in dev tools it will only add a string.
so js will auto-translate it to browser-friendly code.
before:
<div class="text-white">
after:
// ✅ here what I get
<div class="text-white hover:bg-blue-500">
// here what maybe the guy think it will happen
// or I don't know what bug he talking about
<div class="text-white ${pseudo}:${className}">
like you see the browser it correctly adds it.
so I don't get where is wrong the script, so I will correct it because having bugs in the future.
currently I am using html,css only. maybe the bug will happen only on react and framework where you can't do classList.add()
but directly write the class in the return?
I don't know , if someone is experienced and know the bug he talking about tell me.
(and if is something I don't need to worry about, tell me also so I will use it everywhere in the projects)