Tailwind-Merge Is Incredibly Useful - And Here's Why!

Поділитися
Вставка
  • Опубліковано 1 гру 2024

КОМЕНТАРІ • 178

  • @dealloc
    @dealloc Рік тому +58

    Probably one of the best videos explaining the problem, a solution that doesn't work and explain why, then go on to present a better solution. This is quite rare in tech videos, which often skip over the why's and hows. Kudos!

    • @simonswiss
      @simonswiss  Рік тому +5

      Thank you, I appreciate this comment that balances the "get to the point, you wasted 10 minutes!" comments. Glad you enjoyed the progressive explanation - I wanted the message to land properly.

    • @dealloc
      @dealloc Рік тому +2

      @@simonswiss You will always have people who don't know how to use the UI to skip parts in a video. Keep creating good content for people who care :)

    • @simonswiss
      @simonswiss  Рік тому

      That's a good way to look at it, thank you! 🙏

    • @abhyuday911
      @abhyuday911 Рік тому +1

      @@simonswissi’m new but i’m loving it ❤

    • @simonswiss
      @simonswiss  Рік тому

      @@abhyuday911 Thank you so much! ❤

  • @joemart6887
    @joemart6887 Рік тому +11

    The brightness of this video has left me blind for the rest of my life.

    • @simonswiss
      @simonswiss  Рік тому +4

      I am preparing you for the outside world when it's time to go get some fresh air 🤗

  • @faheemulhassan7614
    @faheemulhassan7614 8 місяців тому +2

    well explained. I was beginner learner and stuck in this problem. went thorugh your video and just fully satisfied. Thank you so much !!

  • @plitzcorporation5589
    @plitzcorporation5589 11 місяців тому +1

    In my full time job, we use WP as a headless CMS, and this library has solved a lot of issues when pulling the classes from the blocks.

    • @simonswiss
      @simonswiss  11 місяців тому

      Yeah that's a great use case for that scenario!

  • @johnhuang6609
    @johnhuang6609 9 місяців тому +1

    Awesome video bud, as a library author I have been getting stuck in this like sneaky problem.

  • @skewie88
    @skewie88 Рік тому +4

    Thanks for explaining the problem. I ran into this when updating tailwind, all of a sudden everything looked wonky. I looked into twmerge but felt like it was a hassle to update the whole codebase to call a utility function. Feels like something that should be solved at compile time.

  • @psybitcoin
    @psybitcoin Рік тому +3

    Make more of these tailwind videos! Love it

    • @simonswiss
      @simonswiss  Рік тому

      Yeah, a lot of folks seem to love it, and I love it too :)

  • @edriso
    @edriso 5 місяців тому +1

    Found you on Laracasts, thanks for this great content and vibes man God bless 🙌

    • @simonswiss
      @simonswiss  4 місяці тому +1

      Am I on Laracasts? Do you mean in the comments?

    • @edriso
      @edriso 3 місяці тому +1

      @@simonswiss Yes in the comments section, it was motivating learning with you and others.

    • @simonswiss
      @simonswiss  3 місяці тому +1

      @@edriso haha awesome!

  • @danielnoworyta
    @danielnoworyta Рік тому +2

    Cool video Simon. One of the best explanations of this problem in TWCss.

    • @simonswiss
      @simonswiss  Рік тому +1

      Glad it was helpful! Yeah I tried to explain it as good as I could, even if it took a bit more time to deliver 👍

  • @hoangtran-ek8mn
    @hoangtran-ek8mn Рік тому +1

    Very comprehensive! Thank you so much!

    • @simonswiss
      @simonswiss  Рік тому

      Super glad you enjoyed the video!

  • @John-eq5cd
    @John-eq5cd 7 місяців тому +1

    Very clear and useful, thanks !

  • @prashank
    @prashank Рік тому +3

    Pretty cool tool, thanks for showing us!

  • @allsunday1485
    @allsunday1485 Рік тому +47

    Hey Simon, would you please consider using dark mode? The white screen flashbang is really hard in the eyes, especially at night, and I mean hard as in squinting my eyes and then giving up on the video. Love your content and I hope you give this some thought.

    • @simonswiss
      @simonswiss  Рік тому +12

      Thanks for the suggestion. I struggle with the opposite with my eyes, but you make a good point. I usually use Night Owl Dark and no one ever asked for light - so I'll do the next video in dark theme!

    • @allsunday1485
      @allsunday1485 Рік тому +2

      Never thought the opposite was algo possible! It makes sense. But yes, flashbangs are something that always gets comments throughout UA-cam, and some UA-camrs even warn before one happens.
      Keep up the good work bud, and I'd love to hear your take on tailwind and toast notifications solutions like react-hot-toast that don't make it necessarily trivial to integrate with it.

    • @akza0729
      @akza0729 Рік тому +2

      I agree. It just piercing

    • @twothreeoneoneseventwoonefour5
      @twothreeoneoneseventwoonefour5 Рік тому +2

      You shouldn't watch anything in darkness anyway. That's bad for your eyes, like really bad. You should always have some kind of light.
      I am coding just fine with a light theme at 3am. Why? Because I have the fricking lights on.

    • @lupinza_
      @lupinza_ Рік тому +2

      Hi Sunday, Maybe try watching the video during the same time of day as Simon

  • @ronaldtejada8846
    @ronaldtejada8846 8 місяців тому +1

    Awesome Video buddie!

  • @greendsnow
    @greendsnow Рік тому +13

    9:52 You've been waiting for THIS part for almost 10 minutes.
    The thing is that this library opens the gateway to tailwindized component libraries all over the place.
    You will finally be able to Bootstrap + Tailwind with no issues (I guess)

    • @simonswiss
      @simonswiss  Рік тому +3

      Can't appreciate the destination without embracing the journey 🤗

    • @GameDSS
      @GameDSS Рік тому +3

      It's good to explain the problem before showing off the solution. But a timestamp would be appreciated for people that just want to see how it works!

    • @simonswiss
      @simonswiss  Рік тому +2

      @@GameDSS There are chapter timestamps in the video description and you can see them on the video timeline 👍

  • @MishaMoroshko
    @MishaMoroshko Рік тому +12

    Thanks Simon for recording this video and explaining the why.
    What would you recommend doing in situations where I’d like to allow the users of to override certain classes (e.g. ) but restrict (or, at least warn) users from overriding other classes (e.g. )?

    • @simonswiss
      @simonswiss  Рік тому +3

      Thanks! In that scenario I think it makes sense to setup a few style props for spacing, width etc instead. Sort of how Theme UI or Shakra UI work, if you are familiar with them. Or a "layoutClasses" prop that only allows "contextual" classes (width, margin, display etc). Might be a bit confusing for the user though 😅

    • @nazarshvets7501
      @nazarshvets7501 Рік тому +1

      1. U can add jsdoc to the `className` prop, and tell users about ur intention
      2. U can add, for dev mod only, runtime checks and logs. This can be a little bit complicated bcs u need to cover custom matching (or maybe there is already a solution idk)

  • @pookienesh
    @pookienesh Місяць тому

    i like your video. Clear and well explained. Kudos!

  • @JimOHalloran
    @JimOHalloran Рік тому +3

    That's pretty cool. I've never had that issue, didn't even know that was a thing. But now that I stop for a second and think about it, it seems obvious. And also, I wonder why I've never seen this issue, since it seems like I should have. Although I might have hacked a workaround to something just like it the other day!

    • @simonswiss
      @simonswiss  Рік тому

      Maybe you got lucky with alphabetical color overrides, and always passed classes generated lower in the CSS output 😅

    • @JimOHalloran
      @JimOHalloran Рік тому +1

      @@simonswiss Maybe. I also tend to handle situations like your example by defining a "theme" property on the button, then handling the selection of classes entirely within the component rather than passing classes in. So I've probably mostly avoided it using different design patterns.

    • @simonswiss
      @simonswiss  Рік тому

      Yep, what you describe (style variants via props) is definitely the way to handle various styles.. but even then, I had accidentally a sneaky conflicting padding classes combo when having 4-5 composable style variants, even trying to be careful with separating styling concerns between 'size', 'look' 'shape' etc.
      Can indeed be avoided but sometimes it becomes quite involved with multi-style variants.

    • @simonswiss
      @simonswiss  Рік тому

      Another tool that can help with that is CVA by Joe Bell - will probably do a video on that as a pretext to try it out!

    • @JimOHalloran
      @JimOHalloran Рік тому +1

      @@simonswiss Yeah, padding was one I was specifically thinking of. The number of times I must have mixed sm:p-, p-, px- and pl- or pr- together on the same div and seem to have gotten away with it. Granted some of those will be different CSS properties, so CSS would presumably resolve that conflict internally. There's a few times, I've found myself thinking "The class is at the end, so it must be winning". which as you pointed out in the video is actually CSS order, not class order. So I feel like I must have been down this rabbit hole without recognising it, then hacked my way out without really understanding what I'm doing.

  • @tririfandani1876
    @tririfandani1876 Рік тому

    `tailwind-merge` also supports custom conflicting class names.
    let's say we have custom class names that should conflict if we pass it together, e.g `alert-success`, `alert-error`, `alert-info`
    if you use normal/default `twMerge`, it can't detect the conflict because `alert-success`, `alert-error`, `alert-info` is not supported by tailwindcss by default.
    but we can use `extendTailwindMerge` or `createTailwindMerge` and define our custom conflicting class names
    pretty neat

    • @simonswiss
      @simonswiss  Рік тому

      Yeah, that's really cool! Have not used this myself, but I saw it in the README docs 👍

  • @anirudhcodes
    @anirudhcodes Рік тому +1

    Such an intelligent video, thanks for making!

    • @simonswiss
      @simonswiss  Рік тому

      Thank you, glad you enjoyed it!

  • @wahyusa
    @wahyusa Рік тому +1

    Thank you! really love your explanation

    • @simonswiss
      @simonswiss  Рік тому

      That's great to hear, thank you!

  • @focusroom_
    @focusroom_ Рік тому +1

    This is super useful!

    • @simonswiss
      @simonswiss  Рік тому

      Definitely can solve a bunch of subtle problems!

  • @boopfer387
    @boopfer387 Рік тому +1

    excellent explaination

  • @amarbir22
    @amarbir22 Рік тому +3

    Thanks Simon, can we have a video on how to make reusable components with Tailwind ?, Where UI can be customized using props. Similar to how MUI and other component libraries work.

    • @simonswiss
      @simonswiss  Рік тому +1

      It's not free, but I have a Pro Tailwind workshop on exactly that, which I think you'd like: protailwind.com/workshops/multi-style-tailwind-components
      I also have a free article covering _some_ of the contents, you might start with that :)
      www.protailwind.com/just-in-time-friendly-style-variants-in-tailwind-css-ui-components-part-1

  • @HeyNoah
    @HeyNoah Рік тому +1

    Awesome explanation video!

    • @simonswiss
      @simonswiss  Рік тому

      Thanks Noah! That would work perfectly well in the components we built in the Multi-Style Tailwind Components workshop :)

  • @milankrunic3093
    @milankrunic3093 Рік тому +1

    Great tutorial!

    • @simonswiss
      @simonswiss  Рік тому

      Thank you, happy yo hear you enjoyed it!

  • @Stoney_Eagle
    @Stoney_Eagle Рік тому +3

    I got something to do tomorrow 😱 what a lovely package. No more bang classes 🎉
    Does this fully work with custom extend items and prefix plugins?

    • @simonswiss
      @simonswiss  Рік тому +1

      I don't think it directly supports plugins, but you may be able to write custom plugins for tailwind-merge, as explained here: github.com/dcastil/tailwind-merge/blob/v1.12.0/docs/writing-plugins.md

  • @butadpj
    @butadpj Рік тому +1

    How did you still get tailwind intellisense on the Button’s className props? Im not getting any tailwind suggestions on my end once I pass the className as props

    • @simonswiss
      @simonswiss  Рік тому

      You can extend the surface area of the Tailwind intellisense with the classList option: github.com/pro-tailwind/course-multi-style-components/blob/main/.vscode/settings.json#L5

  • @maxwebstudio
    @maxwebstudio Рік тому +1

    Ohhh nice one ! Thank you !

  • @wahhaab7
    @wahhaab7 Рік тому +1

    Amazing, didn't know there was something like that

  • @TutoDS2014
    @TutoDS2014 Рік тому +1

    One question, what the impact on performance when use the `twmerge`?

    • @simonswiss
      @simonswiss  Рік тому

      I haven't done benchmarks or anything, but it indeed does have a tiny bit of runtime JavaScript. So it will never be as performant as "just CSS", but I think the impact is pretty minimal. tailwind-merge can run on the server (server components) and only the computed classes get sent to the client, nothing else.
      I would say, the performance hit is pretty minimal - but don't use tailwind-merge unless you have the sort of problems/challenges that tailwind-merge is helpful with!
      Hope it helps!

    • @mharrisonb
      @mharrisonb 9 місяців тому

      @TutoDS2014 Note that the absence of a run-time cost or including tw-merge in your JS bundle is true *only* of server components - if you have a regular component in a server-side rendering framework like next.js or Remix, even if if you don't use `useEffect` or change any props to cause it to re-render on the client, it will still render at least once on the client because that's how react hydration works, so tw-merge would still run in the browser in that case. Probably a minor concern for most projects, just explaining FYI

  • @AnsBdran
    @AnsBdran Рік тому +1

    what if the base styles you want to override are defined in css stylesheet,
    className={twMerge(`input-group`, 'border-danger-900')
    this doesn't work

  • @SaurabhSrivastava-i1q
    @SaurabhSrivastava-i1q 11 місяців тому +1

    For some reason, it is no longer working on my setup!
    EDIT: If you are using prefix in the tailwind, make sure to extendTWMerge like this:
    import clsx, { ClassValue } from "clsx";
    import { extendTailwindMerge } from "tailwind-merge";
    const twMerge = extendTailwindMerge({
    prefix: "tw-",
    });
    export default function cn(...inputs: ClassValue[]) {
    return twMerge(clsx(inputs));
    }

  • @nikhilpsathyanathan
    @nikhilpsathyanathan Рік тому +1

    How does it works if I have a custom tailwind config based on a style guide?. Do I have to make any modifications?

    • @simonswiss
      @simonswiss  Рік тому +1

      Not sure I totally understand the question, but I feel like this docs page should get you going: github.com/dcastil/tailwind-merge/blob/v1.12.0/docs/configuration.md

  • @ivodelev9794
    @ivodelev9794 Рік тому +1

    Thanks for this video, one quick question:
    How do you guys handle tooltips on disabled elements(Button, Inputs, ...exc) ?

    • @simonswiss
      @simonswiss  Рік тому

      I haven't had to do that before, not quite sure how to answer this without looking at a specific example!

  • @huytranvan2754
    @huytranvan2754 Рік тому +1

    How can we use tailwind-merge with @apply in css files? Thanks

    • @simonswiss
      @simonswiss  Рік тому

      You probably can't. Tailwind merge is JavaScript that runs when your component function is executed, at run time. It does its conflict resolution in JavaScript, so you won't be able to do this in a CSS file.
      You can probably use it in a Tailwind plugin though, since twMerge works on the server as well.

  • @toastrecon
    @toastrecon Рік тому +3

    So, as very much a beginner: the "className" prop is available on the component (in this case, Button), and so we use TW-merge to bring in any "overriding" TW styling and merge it with the styling we've declared for the component. That way, we can still use our reusable component wherever we want, but if we want to make it a different variant, we can just pass whatever changes we need. Would it be wise to have a different prop passed in? Like, let's say that we want the button to be a warning style, so we'd change the background and text color to shades of red and we wanted the shadow to be larger. We could pass those in via "className", but maybe we could also pass it as a custom prop called "style" (e.g. "style" would be "warning" in this case) or something and then have logic within the component that would handle the styling?

    • @simonswiss
      @simonswiss  Рік тому +1

      Yep, absolutely. You typically would have specific style "variants" via props like "size", "impact", "tone" etc where you can handle custom styles. Passing a classname attribute (can also be another prop name) is more of an "escape hatch" when you want to do something very unique/werid/one-off.

    • @simonswiss
      @simonswiss  Рік тому +1

      In one of my Pro Tailwind workshops, we cover precisely what I think you're asking for, in case you're interested: www.protailwind.com/workshops/multi-style-tailwind-components

    • @toastrecon
      @toastrecon Рік тому +1

      @@simonswiss Thank you! Cool, I'll check it out!

  • @obouchari
    @obouchari Рік тому +2

    Great video as always! Could you please share the VS Code plugins you use for tailwind and such? Thanks

    • @simonswiss
      @simonswiss  Рік тому +2

      It's mostly the Tailwind Intellisense extension. Outside of that, I use prettier with format-on-save, and the prettier-plugin-tailwindcss Prettier Plugin for class sorting. Night Owl theme (light or dark), Dank Mono font. That's about it!

  • @moubiosu2258
    @moubiosu2258 5 місяців тому +1

    may i have your font style and color theme of vscode? love it very much, thx

    • @simonswiss
      @simonswiss  4 місяці тому

      Dank Mono font - Night Owl theme ✨

  • @justaguy5367
    @justaguy5367 Рік тому +1

    Hey Simon, I'm a first timer just discovered your channel and I love it, just wanna ask you about your browser, is it customised or what? it looks beautiful

    • @simonswiss
      @simonswiss  Рік тому

      This is ARC browser - it looks like this by default and you can customize a lot of things. An absolute treat for scresncasts, and all chrome devtools / extensions work seamlessly 💫

    • @simonswiss
      @simonswiss  Рік тому

      Also, thank you for your kind words on my channel, and welcome aboard!

  • @bernardkissi7100
    @bernardkissi7100 Рік тому +1

    What fonts are using for your editor

  • @shinobi_coder88
    @shinobi_coder88 Рік тому +1

    Yeah i know, but what is the point to have className with the same conflicting CSS ? If we wanna do p-5 then why do we need p-6 for? And for Responsive Design we can do it like sm:p-5 md:p-6 p-6 . What I'm trying to ask is, why do we need to override classes and what's the point of having conflicting properties?

    • @simonswiss
      @simonswiss  Рік тому

      There is no point having conflicting properties, ever. But there are many scenarios where you accidentally end up with conflicting properties - or cases where it's tricky to avoid those or make a specific one "win". Tailwind Merge helps with that.

    • @shinobi_coder88
      @shinobi_coder88 Рік тому +1

      @@simonswiss oh I see, thank you

    • @simonswiss
      @simonswiss  Рік тому

      No worries, you're welcome!@@shinobi_coder88

  • @syamsarosa5916
    @syamsarosa5916 Рік тому +1

    May I know why did you stop making video in tailwind labs Simon?
    Anyway, upload here or in tailwind labs, doesn't really matter as long as you upload new tutorial. Keep up the good work. Have a nice day.

    • @simonswiss
      @simonswiss  Рік тому

      The answer is very simple: I got fired. One day, as I was editing a video, I got the good ol' "Hey, got 5 min to chat" DM on Discord. 5 minutes later, I was cut from the team, and removed from the UA-cam channel.
      Surprisingly, there is only one new video on the channel in 1+ year. Turns out making good videos is hard and time-consuming, as they found out!
      I honestly think they decided to rely on community influencers like Sam Selikoff or Theo to substitute the need for a first-party UA-cam channel. I was loving my job and had no intention of going anywhere.

    • @syamsarosa5916
      @syamsarosa5916 Рік тому +2

      @@simonswiss bro... I never thought it was because of that. Sorry to hear that.
      Wish you all the best bro. Hopefully your channel can grow as big as tw lab. With your knowledge & method of teaching, I'm sure it will. Keep up the good work.

    • @simonswiss
      @simonswiss  Рік тому

      @@syamsarosa5916 thank you so much ❤️❤️

  • @jessypouliot8374
    @jessypouliot8374 Рік тому +1

    This is cool but I would be concerned about using this on a server side rendered page. Given a page has hundreds or thousands of twMerge calls and a server has a lot of traffic that's a lot of extra function calls for just a bad className design in the first place. There's the !important variants that exists that can do exactly this and better code overall will help more than this IMO

    • @simonswiss
      @simonswiss  Рік тому

      A thousand twMerges in one single page? Yeah that's probably a lot.. !important variant is great indeed, but it assumes you *know* what classes are conflicting, so you can decide which one should win.

  • @clakams
    @clakams Рік тому +1

    What coding font is that? interesting

    • @hynekss8618
      @hynekss8618 Рік тому +1

      I guess it's Operator Mono by Hoefler&Co. It's a paid font; however, I vaguely remember there's an open source 'replica' available.

    • @twothreeoneoneseventwoonefour5
      @twothreeoneoneseventwoonefour5 Рік тому +2

      It is definitely Dank Mono. I am sure 100% because I also use this font for more than a year already. The f that goes below the line is unique in that font (among other stuff like italics of course).

    • @simonswiss
      @simonswiss  Рік тому

      Dank Mono!

    • @simonswiss
      @simonswiss  Рік тому

      Nope, Dank Monk. Also a paid font, but significantly more affordable!

    • @simonswiss
      @simonswiss  Рік тому

      You are indeed 100% correct!

  • @technobanjo
    @technobanjo Рік тому +2

    can u describe the video in braile pls I just went blind from all the light mode

    • @simonswiss
      @simonswiss  Рік тому +2

      Sorry, can't see your comment, also looked at my own light theme.

  • @mariavillen5237
    @mariavillen5237 Рік тому

    You need to config all custom classes in tailwind config for twmerge config also (so you have to config your custom classes twice) and if you make something like className = {twMerge("w-96", "w-full")} it is not working, so bug.

  • @ThomazMartinez
    @ThomazMartinez Рік тому +1

    so is that better than clsx?

    • @simonswiss
      @simonswiss  Рік тому +1

      It's different! clsx doesn't merge conflicting Tailwind classes - but if you only need to combine classes, clsx may be better!

  • @thomasz5560
    @thomasz5560 Рік тому

    does it work for react native ?

  • @marvelbox
    @marvelbox Рік тому

    thanks for this

    • @marvelbox
      @marvelbox Рік тому +1

      by the way, I'm confused about whether it should be installed as a dependency or devDependency. what do you think?

    • @simonswiss
      @simonswiss  Рік тому +1

      @@marvelbox dependency, because it's a runtime library 👍

    • @marvelbox
      @marvelbox Рік тому

      ​@@simonswiss such a quick reply. thanks a latte

  • @benemma5602
    @benemma5602 Рік тому +1

    real game changer, but notcied it doesn't work with component classes e.g @layer components

    • @simonswiss
      @simonswiss  Рік тому

      Hmmmm, component classes typically affect multiple CSS properties, so it would be pretty hard to merge those. I haven't tried, but I don't feel like passing a component class to a UI component with its own styles is gonna go too well in any scenario.
      Passing classes to a component is usually a one-off, escape hatch way of doing a change you really need to. Not the primary way of composing styles, in my opinion.

  • @k16e
    @k16e Рік тому +1

    Is this a Tailwind class or a React?

    • @simonswiss
      @simonswiss  Рік тому

      Which one? twMerge? It's not a class, it's a JavaScript function. It's neither React nor Tailwind, it's... its own thing 👍
      But yes it works *with* Tailwind and React (and I imagine other JS frameworks).

  • @arifurrahman9133
    @arifurrahman9133 Рік тому +1

    I love it

  •  Рік тому +2

    WOW

  • @jaedanpersaud9490
    @jaedanpersaud9490 Рік тому

    why not just join the className as a template literal and avoid the function?

    • @simonswiss
      @simonswiss  Рік тому

      Hmmm because the function is what contains the logic to resolve conflicting classes? You can definitely do it all manually with string concatenation and interpolation. If you know exactly what you are doing - and then no runtime cost 👍

  • @hakuna_matata_hakuna
    @hakuna_matata_hakuna Рік тому +1

    Are you fo real my brother in Christ? Light mode !!!!!!!!!

  • @LarsRyeJeppesen
    @LarsRyeJeppesen Рік тому

    Yeay!! more fugly jsx code :)

    • @Hurtwolf
      @Hurtwolf Рік тому +1

      Vi ka li det!

    • @LarsRyeJeppesen
      @LarsRyeJeppesen Рік тому

      @@Hurtwolf det er syre for øjnene

    • @Hurtwolf
      @Hurtwolf Рік тому

      @@LarsRyeJeppesen Jep. Har også installeret "Inline Fold" Extension.

  • @phojie6868
    @phojie6868 Рік тому

    that is why, its better to use unocss xD

  • @judahwilson6756
    @judahwilson6756 Рік тому +1

    nice, a midi keyboard

    • @simonswiss
      @simonswiss  Рік тому

      Do you mean the Rodecaster Pro? It's an overly fancy audio interface/podcasting station.
      That said I do have a midi keyboard on my desk, but just off camera! 😅

  • @leanazulyoro
    @leanazulyoro Рік тому

    I keep seeing this stuff because at work I'm forced to use tailwind. I can't believe people are buying tailwind, I can't believe people are excited for these solutions that would not be needed if not using tailwind in the first place. I can't believe people getting excited for a new tw version that supports x feature that css has supported for years... all of it because they don't like coming up with names for the elements to use as classes. Guess what... you still need to come up with names for your components, and you're left with a bunch of new issues, which is why you're now on yt watching this. :facepalm:

    • @simonswiss
      @simonswiss  Рік тому

      Tailwind CSS is free. I guess you mean Tailwind UI templates/components. And I can't believe you spent the time to complain about all of this in a UA-cam video. Most people use Tailwind because they love the productivity and confidence they get with it. Not naming classes is just one aspect of that productivity boost.

    • @leanazulyoro
      @leanazulyoro Рік тому +1

      @@simonswiss didn't mean "buying" in the literal sense

    • @simonswiss
      @simonswiss  Рік тому +1

      @@leanazulyoro Ah, gotcha - "buying into" Tailwind. I originally thought the same with Tachyons, and most people do start by hating/rejecting it. If you still don't like it after using it... I am sorry you are forced to use it at work. On the flip side, I ended up quitting jobs because I could not use Tailwind and I was becoming miserable 😅

  • @joestrkr
    @joestrkr Рік тому +2

    The button example is not so contrived 😂

    • @simonswiss
      @simonswiss  Рік тому

      Yeah lol buttons can get crazy. This particular example was pretty dialed down 😅

  • @joe-robin
    @joe-robin Рік тому +1

    Coding in white theme should be a CRIME

    • @simonswiss
      @simonswiss  Рік тому

      It's terrible isn't it? But it's too bright out here and I can't deal with the glare in dark themes 😅

  • @RyuuuGamingUnlimited
    @RyuuuGamingUnlimited Рік тому

    12 mins of explaining something so simple........................................................................ get to point damn it!

    • @simonswiss
      @simonswiss  Рік тому

      Believe it or not, I've tried many times, in shorter form, and the message was not received. I also have a 2:20 version of this video on Twitter. I am terribly sorry for wasting 12 minutes of your life, happy to provide a refund on this free video 😅

    • @killemalljustice
      @killemalljustice Рік тому +1

      Use the chapters 🙄

  • @TwoLeggedTriceratops
    @TwoLeggedTriceratops Рік тому +1

    Your IDE preference are sinful 😂 jk

    • @simonswiss
      @simonswiss  Рік тому

      So I am being told in these comments 😅
      Noted, noted 🤣

  • @HaithamAli-fy8vo
    @HaithamAli-fy8vo Рік тому +1

    clsx works fine, am I missing something?

    • @twothreeoneoneseventwoonefour5
      @twothreeoneoneseventwoonefour5 Рік тому +1

      yes, this one removes conflicts
      p-4 and p-5 get merged into "p4 p5" which doesn't make any sense in clsx
      in tailwind merge they get merged into just "p5"
      that gets rid of some of css conflicts that DO EXIST, you can research it yourself if you are interested.

    • @simonswiss
      @simonswiss  Рік тому +1

      clsx works great but will not resolve conflicting styles, so you'll sometimes have unexpected results, just like the video explains. twMerge is very similar to clsx, but does ensure only one class per CSS property is being set on the element when merging strings.

  • @je9625
    @je9625 Рік тому +1

    React is needlessly complex.

    • @simonswiss
      @simonswiss  Рік тому

      For this simple example, yes, but it's very useful for more advanced stuff!