DEV Community

Cover image for Day 78: I found a Tailwind CSS secret ๐Ÿ˜‰
Ivad Yves HABIMANA
Ivad Yves HABIMANA

Posted on

Day 78: I found a Tailwind CSS secret ๐Ÿ˜‰

Hi!
Today I found a secret in Tailwind ๐Ÿ˜Ž, actually is not a secret per se it's just something that I had no idea about and have fighting with with for some time.
Let's say we have a React component that has some tailwind classes as styles, and you can call that component pass more style classes as props, what if you want to call the component and override some default tailwind classes by sending the same classes values as props?
I thought by placing new classes (props) at the end they will override default styles and it worked in some case but I was surprised to find that it's not always the case.
and that's because of CSS Cascade.

Actually this issue is explained in more details in this article

after reading I used the Tailwind-merge package and the issues I had with styles was solved but I have also found other alternatives that are worth looking into but I think this was something interesting to learn today.

Today I was mainly working with a friend on consuming a Graphql API on the frontend using apollo client and I learned some new content to and I later looked into phone authentication with Firebase which I plan to implement tomorrow.

So tomorrow will be for Firebase, maybe an article and some rest and that will be enough for the week

Signing off...

Top comments (0)