Styling React Components with CSS Modules

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

КОМЕНТАРІ • 130

  • @bkatsevych
    @bkatsevych Рік тому +29

    Probably the best explanation of CSS Modules you can find on UA-cam. Thanks a lot, Telmo!

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

    Before watching this tutorial, I used to find css modules and its import and reference styles using JavaScript syntax quite complex for its benefits. That's why I avoided modules like the plague. Thank you Telmo, this was very helpful!

  • @Webtricker
    @Webtricker 2 роки тому +12

    Thank you so much for explaining React components with CSS modules in such a simple and beautiful way. That was very helpful

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

    honestly as someone who just came here to learn about css in react... you taught me a new concept i didn't knew about thanks

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

    i was looking everywhere because i had very problems with the css styles , and you have resolved it, thanks a lot Telmo

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

    I had one question. let's say there are two components, A and B
    and two CSS files A.css and B.css, and compo A and B have several in them now
    let's say I want to color all buttons in A red and all buttons in B blue.
    can I solve this problem without giving the class name to ?

  • @danieltkach2330
    @danieltkach2330 3 роки тому +2

    You rock. Thanks for the instruction. Why everyone says we have to either eject or install some script modules from start? What you describe works just fine...

  • @victoradodo8377
    @victoradodo8377 2 роки тому

    Special thanks YOU deserved NATIONAL AWARD

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

    man you are a god of teaching for sure

  • @Trafficfromsky
    @Trafficfromsky 3 роки тому +2

    how do you target/change the tag without a class name?

    • @itouchgrass869
      @itouchgrass869 2 роки тому

      Just use “body” selector without a class

  • @jiharedconteh4530
    @jiharedconteh4530 10 місяців тому

    This video is very useful for styling individual components. Thank you for such a simplified explanation.

  • @redefamatv
    @redefamatv 2 роки тому +2

    Thanks for sharing Telmo, Im still learning the basics of react but it was a really helpful tutorial to strengthen my basic knowledge in order to going forward to more advanced tips very soon...hugs from Brazil...just keep it up.

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

    UA-camrs like you deserves lot of subs. I subbed you. Please do make React tutorials in depth with building projects like TODO and ecommerce etc.

  • @yinkagiwa8659
    @yinkagiwa8659 3 роки тому

    I love how clear the video is

  • @lingolearner27
    @lingolearner27 8 місяців тому

    you solved my problem. was stuck with this for couple of hours. thank you bro.

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

    Great video helped me understand css modules

  • @electricindro2236
    @electricindro2236 2 роки тому

    Thank you for explaining the importance of React css module

  • @SofiaBelchiorinho
    @SofiaBelchiorinho 2 роки тому +1

    Very useful vídeo :) I was using this technique already (because it comes with Nx workspaces) but I ddin't know it was called CSS Modules. Keep up the good work!

  • @coding_stuff_uz
    @coding_stuff_uz 7 місяців тому +1

    Tankyou bro for this tutorial

  • @NoajmHeritage
    @NoajmHeritage 8 місяців тому

    Prefect. Chatgpt failed to give me this option.
    Amazing for no css conflict

  • @nishantsinha4336
    @nishantsinha4336 10 місяців тому

    Made it look simple.Well explained!

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

    Great video, very well explained. I don't really see the point in using modules though... you have to type a lot more code for it to just add a unique classname in the end anyway so why not use id for individual styling and then you can use classnames for universal styling?
    Like if I wanted all the buttons to have 20px padding I could give them the classname of btn and give them all 20px padding and then I could use an id for each button also to, for example, change the background color if I wanted them to have different background colors.

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

    I get the problem it solves, just not why the problem is there in the first place.
    Like, we have a component called Example.js
    In that, we import example.css
    So since this is the only place that this CSS is imported and therefore used, why can it conflict with other components? They havent linked/imported the stylesheet?

  • @Mattyamungu
    @Mattyamungu 22 дні тому

    Thanks you. Was wondering why I was having issues sizing my page

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

    It's cool when there is like 2 styles to scope but when you want it scoped for each components just switch to vuejs

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

    So simple and straight forward....I love it. Thank you

  • @kunaljethva9623
    @kunaljethva9623 3 роки тому +1

    Thanks for making this video was searching for it since 😊😊

  • @pumdu
    @pumdu 2 роки тому

    Thanks a lot. I wondered why I need to use CSS module and this video made it clear to me. :)

  • @mathiasmatanda8848
    @mathiasmatanda8848 2 роки тому

    You saved me from a big headache thank you man!

  • @Viktorres1
    @Viktorres1 2 роки тому

    Thanks for your video. I fastly reminded how to connect css (scss) modules.

  • @qanswered319
    @qanswered319 2 роки тому

    Great video.understood module clearly. No time wasted

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

    Should we do it for every single class?

  • @codelightsparkles2403
    @codelightsparkles2403 3 роки тому +2

    You’re awesome Telmo

  • @AYUSHSHARMAblogs
    @AYUSHSHARMAblogs 2 роки тому

    Lots of thanks for such a wonderful video on css modules

  • @FaselGodbcho
    @FaselGodbcho 6 місяців тому

    thank u, I was so frustrated and this video helped a lot

  • @igelkotte
    @igelkotte 11 днів тому

    This seems more complex than to just use a different css class name. What's the benefits? I'm new so I'm probably missing something

  • @anaisrevellat5692
    @anaisrevellat5692 2 роки тому

    Thank you this tutorial is crystal clear , perfect.

  • @heikkiladau6872
    @heikkiladau6872 7 місяців тому

    Can you add css styles inside of the script tag in react application?

  • @rakhmatillorakhmonberdiev231
    @rakhmatillorakhmonberdiev231 3 роки тому

    Thanks bro, that is what I expected to understand this topic, very clear explanation!

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

    Thank you for simple explantion TELMO✌✌✌✌we are looking forward to the others videos😊😊😊

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

    thank u sr, this tutorial was very usefull for me , and im glad, the way u used to explain , gave me some Brainstorming thanks guy.

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

    What a fantastic explanation, thank you so much

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

    really like your accent very good way of teaching

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

    Very useful! Thanks for sharing!

  • @pravinchoudhary5105
    @pravinchoudhary5105 2 роки тому

    Thanks Man, Helped a lot

  • @gihanrangana6248
    @gihanrangana6248 3 роки тому +1

    how can i create global variables for scss modules?

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

    Thank you, man. It really helps me a lot.

  • @teeyiheng4697
    @teeyiheng4697 2 роки тому

    I understand why use css module now thank😆

  • @raunakkumar6144
    @raunakkumar6144 10 місяців тому

    Thanks man , I was having exact same problem

  • @Whisperme2sleep
    @Whisperme2sleep 2 роки тому

    How do you do conditional classes with this technique?

  • @ghofranedarragi5601
    @ghofranedarragi5601 3 роки тому

    thank u .simple and clear explanation .it's useful

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

    Thanks you! Explained my issue

  • @patcodingcodester9781
    @patcodingcodester9781 3 роки тому

    Haha thank you!. This is exactly what I was looking for but it was hard to find..

  • @arshadahamed988
    @arshadahamed988 6 місяців тому

    In module.css file can we create more than one class or Id in the file??

  • @siaxiong333
    @siaxiong333 2 роки тому

    Very usefull and great video! I like that you're straight to the point. Thank you so much!

  • @sergiogarcia-di5nj
    @sergiogarcia-di5nj Рік тому

    really really helpful, thank you very much !

  • @Lemon.8
    @Lemon.8 3 роки тому

    Thanks for the tutorial, very well explained.

  • @slipstream01
    @slipstream01 2 роки тому

    excellent explanation. shukran

  • @mahdouirami2776
    @mahdouirami2776 3 роки тому

    When i did it with a complicated name like form-control , it made me an error have u any solution ?

  • @vigneshwarvenugopal922
    @vigneshwarvenugopal922 8 місяців тому

    Thank you so much dude.,
    problem solving .,
    i score you 100 of 100...🌟🌟🌟

  • @webdevvideos2744
    @webdevvideos2744 2 роки тому

    will using css module impact performance?

  • @irorochadere9207
    @irorochadere9207 3 роки тому

    Thanks, buddy.
    It worked well for me.

  • @thisaraharshana2168
    @thisaraharshana2168 3 роки тому

    Thank you sir. well explained!!.

  • @mubashirwaheed474
    @mubashirwaheed474 3 роки тому

    Thanks you so much for this video.

  • @SatishKumar-qi4hb
    @SatishKumar-qi4hb 3 роки тому

    nice and helpful video. thx so much.

  • @davidlafontant2185
    @davidlafontant2185 2 роки тому

    Very useful. Thank you.

  • @phuongla4512
    @phuongla4512 3 роки тому

    Thanks bro. This is useful

  • @herlandertavares7573
    @herlandertavares7573 2 роки тому

    Great video. I didnt even have to see your name, I knew by your accent you were Portuguese lol. Obrigado pelo video

  • @hemantjadhav7833
    @hemantjadhav7833 3 роки тому

    great video sir

  • @ranati2000
    @ranati2000 2 роки тому

    Can i use bootstrap classes in it ?

  • @angelmgl8137
    @angelmgl8137 3 роки тому

    Nice video bro, thanks a lot

  • @rohil3023
    @rohil3023 3 роки тому

    Very useful. Thanks for the tutorial :)

  • @janardanpethani5755
    @janardanpethani5755 3 роки тому

    Thanks you for sharing 😀😀

  • @swerami
    @swerami 3 роки тому

    thank you so much for this!

  • @abhishekprasad6317
    @abhishekprasad6317 3 роки тому

    What if i have to apply two classname will I do :- className={stylesCSS.firstclass} className={stylesCSS.secondclass} ? or i have any option similar to: className={stylesCSS.firstclass, stylesCSS.secondclass} ??

    • @abhishekprasad6317
      @abhishekprasad6317 3 роки тому +2

      got the solution stackoverflow.com/questions/33949469/using-css-modules-how-do-i-define-more-than-one-style-name

  • @goncalosantos3604
    @goncalosantos3604 3 роки тому

    Excellent as always! Abraço

  • @ibrahimkhurshid4339
    @ibrahimkhurshid4339 2 роки тому

    Thanks buddy!! Jazakallah

  • @jatinahuja6840
    @jatinahuja6840 3 роки тому +1

    Thank you for helping man! 🙌
    Please keep making such videos 🥇🎖
    Can you also tell how to use css modules concept with bootstrap or I will say if I want to use bootstrap different version. Thanks in advance 👍

  • @CodewithAby
    @CodewithAby 3 роки тому

    Good tutorial...it is timely

  • @roronoa_d_law1075
    @roronoa_d_law1075 2 роки тому

    this is not working for me, the style is still applied globally

  • @amershboul9107
    @amershboul9107 3 роки тому

    really helpful, thanks

  • @arashvincent8519
    @arashvincent8519 2 роки тому

    dose it work with sass ?

  • @davidgrig4608
    @davidgrig4608 3 роки тому

    very helpful tutorual ty very much

  • @markokoth5609
    @markokoth5609 3 роки тому

    Hey Telmo how are you. What's the theme you are using on the vs code?

  • @snake1625b
    @snake1625b 2 роки тому

    className takes in a string but you're passing in a class, how is that possible. sorry if I missed the answer to this

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

    you did not include on your tutorial that we need to do this , module.exports = {
    module: {
    rules: [
    {
    test: /\.css$/,
    use: [
    'style-loader',
    {
    loader: 'css-loader',
    options: {
    modules: true
    }
    }
    ]
    }
    ]
    }
    };

  • @miraasif3419
    @miraasif3419 3 місяці тому

    Thankyou for this man @Telmo Sampaio

  • @carlafaes9282
    @carlafaes9282 3 роки тому

    buen video!muchas gracias :D

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

    Thanks dude:)

  • @RoyerAdames
    @RoyerAdames 3 роки тому

    And how do you add multiple class names?

    • @Telmosampaio
      @Telmosampaio  3 роки тому

      Styles.classname(‘${myclass1} ${myclass2}’)

  • @kaszapnagypeter
    @kaszapnagypeter 3 роки тому

    Thanks a lot, mate! This is exactly what I was looking for! Is it required to give it a module name, or I can name it whatever I want to?

  • @matiascstudios
    @matiascstudios 3 роки тому

    Thanks a lot!

  • @manasjoshi7037
    @manasjoshi7037 3 роки тому

    Thank you for this,

  • @nullcarry6893
    @nullcarry6893 3 роки тому

    Hate to say it but vue seems to have a better out of the box solution.

  • @woolygan1529
    @woolygan1529 2 роки тому

    Helpful thanks

  • @dungvu8790
    @dungvu8790 3 роки тому

    thank you

  • @sebastianandersson6892
    @sebastianandersson6892 2 роки тому

    04:06 sounded American for just a second there!

  • @brucelee7782
    @brucelee7782 3 роки тому

    Isnt it easier to store each component's css at the bottom of the page like react native?

  • @felipebatista7469
    @felipebatista7469 3 роки тому

    thanks brow!!!
    by brazil

  • @iamwright
    @iamwright 2 роки тому

    Very good.