Dark Theme React Application [Simplest Way] | Toggle Theme React Tutorial😍

Поділитися
Вставка
  • Опубліковано 16 січ 2025

КОМЕНТАРІ • 130

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

    🤩Access My Complete React Course:- www.udemy.com/course/the-ultimate-react-course-2023-w-real-world-projects/?referralCode=993CD544A6816303D3AD

  • @thosan3090
    @thosan3090 Рік тому +15

    Omg i swear when i search for a tutorial on youtube, it'll be more helpful if i hear the Indian accent, thank you so much sir

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

    When you can apply things you have learned well but if you can explain it to others in the most simpliest way you are a genius!!! Thanks Genius!!
    👑

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

      Thank you so much for your compliment. Grateful for that❤❤

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

    Very useful❤❤

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

    simple, effective and easy to understand. Thanks a lot

  • @SachinKumar-x9r6k
    @SachinKumar-x9r6k 2 місяці тому

    Most underrated channel in whole coders community ❣❣❣

    • @CodeBlessYou
      @CodeBlessYou  2 місяці тому

      Thank you so much for this comment❤❤❤

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

    working. thanks

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

    This is extremely helpful, thanks a lot man!

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

      Thanks for your support. Really grateful for that❤❤

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

    This was very helpful.
    Thank you sooo much :)

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

    i was not expecting this much information but thanks buddy you have done the best work . i really apreaciate your work 💓

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

      Thank you so much for your support❤❤

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

    ❤🎉 Thank You

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

    Nice logic very helpful ❤

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

    Nice one....easy one

  • @МаксимСоловьев-с9н

    This is so simple, thank You!!!

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

    Thank you!

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

    Great video and to the point. Thanks a lot!

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

    Keep uploading bro 👍

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

    Nice video, also filled up the form.

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

    Thanks a lot! New suscriber

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

    Thank you

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

    Really helpful man. Thanks a lot!

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

      Thank you for your support brother😇❤❤

  • @LuisRodriguez-ro5py
    @LuisRodriguez-ro5py Рік тому

    A lot of value in this short video

  • @wesalahmed-pl3mj
    @wesalahmed-pl3mj Рік тому

    thank you soo much you helped me a lot!!

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

    thank you man!

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

    Great video, thanks

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

    Mashallah 😍😍

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

    Why you are using dom in react?

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

    this is gold

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

    At 4:25mins ... i have no idea where u got the "[data-theme="dark]" from ?.. and whats "[data-theme]" ?

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

      [data-theme="dark"] is we add attribute to the body element in our setDarkMode function[at 1:30]:
      document.querySelector("body").setAttribute('data-theme', 'dark');
      [data-theme] is an attribute to know the data of current application theme. If our data-theme="dark", then currently user select dark mode, else user in light mode.❤

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

    Thanks

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

    Thank you so much for sharing your knowledge, Sir.

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

    TYSM!

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

    can you tell us why we need to use ReactComponent for import svg, but we cannot do that with the png or jpg??
    Thanks a lot!!!

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

      See SVGs can be treated like components because they're XML-based, while PNGs and JPGs are static image files that can't be dynamically manipulated in the same way.

  • @anupamrevanth5911
    @anupamrevanth5911 14 днів тому

    Hi sir,actually i am following the course on udemy . I am getting error in the same section while adding darkmode component even after trying same said on tutorial facing same issue unable to resolve can you help ???

    • @CodeBlessYou
      @CodeBlessYou  14 днів тому

      Yes. Show me the error in the QnA Section of that lesson in which you are getting error. I will try to solve that error

    • @anupamrevanth5911
      @anupamrevanth5911 14 днів тому

      @CodeBlessYou sure sir i will

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

    Can we add 3rd and 4th theme also? Like daisyUI?

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

      Yes you can. But keep in mind, more choice more users gets confused.

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

    how to fix the delay on text changing colors?

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

      remove transition CSS from the style

  • @Saivivek-l4c
    @Saivivek-l4c 11 місяців тому

    Hi brother do you have monalisa ttf file as you used in the project can you send it I can use it

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

      It's illegal to share purchased fonts. But you search for that, then you can get that font FREE.

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

    go on my brother

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

      Thanks for your support brother😇❤

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

    I am attempting to use localStorage in a Nextjs environment, but I am getting a "localStorage not defined error". I did some reading and learned it should not work in a Reactjs environment either, yet you are able to. Why is this? Am I missing something? Any help would be greatly appreciated. Thank you so much for your video.

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

      If you are encountering a "localStorage not defined" error, consider the following:
      Make sure you are using localStorage in the client-side code, not in server-side rendering (SSR) or during the build process.
      Check if there are any conditional statements or environments that might prevent the code from running on the client side.
      Confirm that your code is running in the browser environment.

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

      @@CodeBlessYou Thank you so much! I have much to learn regarding the client vs server side rendering, but I greatly appreciate that you've pointed me in the right direction.

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

      @@CodeBlessYou It worked!! You are the best. Thank you, my friend. Just subscribed to your channel!

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

      My pleasure @@nathanielgonzalez9598

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

      Grateful for that brother@@nathanielgonzalez9598

  • @erencetin7805
    @erencetin7805 5 місяців тому

    I did everything what you have done , toggle button appears on the screen but colors don't change.What should I do?

    • @CodeBlessYou
      @CodeBlessYou  5 місяців тому

      Try to inspect CSS, maybe there are some changes

    • @erencetin7805
      @erencetin7805 5 місяців тому

      ​@@CodeBlessYouI solved it , thanks

    • @CodeBlessYou
      @CodeBlessYou  5 місяців тому

      @@erencetin7805 ❤❤❤

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

    After adding that folder, what are all the changes we need to make in the react folder to make it work?

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

      After adding folder, You just need to add DarkMode component in your Component in which you want to display.
      After that you can also modify CSS according to your needs

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

      Sorry Asha, I recently check this DarkMode zip and I uploaded end file at the place of beginner file. You can now download the starter file, that will not give you any error. Sorry for that again

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

    tanks

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

    excelent!

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

    thank you

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

    how can i do this same thing in scss and react

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

      Once you understand the logic of Dark Theme then you can apply it on any thing

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

    I'm getting an error: Warning: Invalid DOM property `for`. Did you mean `htmlFor`?

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

      In react, we can't use for attribute because it is reserved keyword in JavaScript (for loop). Same as class and className. So we have to use htmlFor instead of for in label

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

    I can see that my toggle works but the colours don't change

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

      Try to inspect and check dark attribute is adding or not

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

    i have follow the steps,but i got an error:
    Uncaught SyntaxError: import not found: ReactComponent
    can you give solution?

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

      We get this error because of React Update.
      First you have to install one package, npm install vite-plugin-svgr@3.2.0
      and in your vite.config.js file, you have to add svgr plugin in plugin array.
      Use this github repository - github.com/pd4d10/vite-plugin-svgr#readme

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

    Good logic

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

    Why my css code don't working?

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

      Check you imported CSS file at the top or not

  • @adarsh-chakraborty
    @adarsh-chakraborty Рік тому

    Vs code font & theme?

  • @RajeshKumar-xx8ey
    @RajeshKumar-xx8ey Рік тому

    Hi Bro,
    kindly make a video in React Js bro
    Your Videos make easy to learn react
    ASAP make video in react
    thanks a lot

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

      Currently Working on Complete React JS course which will cover all important concepts with real world projects. You can register for FREE from here: forms.gle/aBtV1aRdcbztDwF3A

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

    can you provide whole code plzzzz

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

      I don't have the source code now. Because I think I record this video one year ago. Still I will check my backup. If it is available then I will inform you❤❤

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

      @@CodeBlessYou ok thanks

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

    where is source code......

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

    When you set the dark theme attribute on the body, aren’t we not supposed to directly change DOM elements when working with React?

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

      You can use this or you can define state variable and change that state variable on toggle and toggle className for our app component div. You can do it both ways

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

    Using querySelector in a react app doesn't look good to me. There should be a better way of doing that.

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

      I will upload the update version on this Video :)

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

    How to toggle data-bs-theme="dark" to data-bs-theme="light" in new Bootstrap 5.3
    My Content

  • @babar178
    @babar178 5 місяців тому

    Hello sir i m very poor and unable to pay for your react paid course can you please provide me for free your react course .plz plz sirr😢

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

      Contact me on Instagram, When I create coupon for React Course I will give you FREE❤❤❤

    • @babar178
      @babar178 5 місяців тому

      @@CodeBlessYou thank you so much sir

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

      @@babar178 Here is the FREE Access - www.udemy.com/course/the-ultimate-react-course-2023-w-real-world-projects/?couponCode=FF4E7D5CD87487F51D26

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

    Nice solution but you don’t use react with states or context and your way is a bit difficult to unterstand

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

      Yes It is Vanilla JavaScript and React also build on Vanilla JavaScript. Thanks for your support. Really grateful for that😀❤❤