29 May 2025
Best practises for Tailwind CSS in React
Prefer to create separate components which have uniform styles throughout the application instead of rewriting the same class names at multiple places or creating a new class name which includes all the tailwind class names using @apply directive.
Doing so would offer us the flexibility of updating our styles with minimal efforts, as we have to update the class names at a single place only.
Suppose we have a h1 tag which will be used at multiple places. We have two approaches to achieve it:
Share: