


So no you would not be able to select it like that. JMadelaine at 22:18 1 The point of a fragment is that it wont render anything. If you start using for everything, you are basically just writing CSS again and throwing away all of the workflow and maintainability advantages Tailwind gives you, for example: Its basically an escape hatch that allows you to return an array of components from a component, so no you cant style it because it technically doesnt exist. Making changes in a project that has tons of custom CSS is worse. Yes, HTML templates littered with Tailwind classes are kind of ugly. Whatever you do, don’t use just to make things look “cleaner”. Changing the font-size for every instance is just as easy as it is with CSS, but now you can turn all of the titles into links in a single place too.
Add style to react fragment update#
Sure you can update the font-size for every instance in a single place, but what if you need to turn the title into a link?Ĭomponents and template partials solve this problem much better than CSS-only abstractions because a component can encapsulate the HTML and the styles. chat-notification Įven if you create classes for the different elements in a component like this, you still have to duplicate the HTML every time you want to use this component. Contributors 204 + 198 others ĭon’t panic! In this guide, you’ll learn about different strategies for reusing styles in your project, as well as best practices for when to employ each one.
