Learn React Hooks: useContext - Simply Explained!

Sdílet
Vložit
  • čas přidán 24. 05. 2023
  • Join The Discord! → discord.cosdensolutions.io
    Source Code → github.com/cosdensolutions/co...
    In this video we will learn about React hooks, starting with useContext. This powerful React hook will allow you to manage your state efficiently without having to pass an enormous amount of props around (prop drilling). You will learn how to identify when to use the React Context API, how to use createContext to create the context, create a custom hook to handle undefined values, and finally use the context in any component to get access to the data.
    In this new React world, hooks are here to stay, so it's best to learn them! In this tutorial I demonstrate the useContext React hook, and I explain it very simply and in a way that is easy to understand. Enjoy!

Komentáře • 267

  • @cosdensolutions
    @cosdensolutions  Před 4 měsíci +5

    Hey everyone! I just launched 🚀 Project React, which is a course that teaches you React by building a real-world project. It goes way beyond what you see in these videos and walks you through step-by-step on how to build a big and complex application with React! You can check it out here: cosden.solutions/project-react

  • @GeraldPajulas
    @GeraldPajulas Před 6 měsíci +8

    Thank you. I've been learning React for about 4 days and I was confused about the useContext and createContext, but your video explains it well. Thank you.

  • @HR-pz7ts
    @HR-pz7ts Před 5 měsíci +6

    It's amazing you also taught how to deal with problems and showed proper way to code and handle potential errors.

  • @shubhankarvalimbe5286
    @shubhankarvalimbe5286 Před 9 měsíci +19

    Great tutorial! I was so confused about how Context works, every other creator complicates it too much. Thank you for simplifying it. Just subbed!

  • @mikoajkulczynski5213
    @mikoajkulczynski5213 Před 9 měsíci +19

    Thank you for the content. You have the gift to talk about coding in a simple way.

  • @osmankain1508
    @osmankain1508 Před 4 měsíci +5

    Wow you're a perfect teacher and programmer thanks for the time that you spent for this amazing content

  • @marshallfungai3033
    @marshallfungai3033 Před 7 měsíci +2

    Thanks man, been watching your videos for the last 7 days. Practicing for mid-senior dev job...
    Now I feel like a junior dev 😁, because of all the content I learnt. I "was" a "I can do it, but I can not explain it" person.
    But the upside is now I "REALLY" know what to do.
    Just subscribed.
    And we need more videos on testing.

  • @omobolanleayobami4998
    @omobolanleayobami4998 Před 23 dny

    I have seen a lot of videos on context but this is the best. easy to understand and follow through. thank you.

  • @user-sy5fd7kn8w
    @user-sy5fd7kn8w Před 3 měsíci +2

    Hands down best explanation of the topic on the tube. Thank you!

  • @camilotorresf1
    @camilotorresf1 Před rokem +25

    This was a really good explanation. I took notes and later was able to replicate a similar example. I now understand the useContext hook a lot better. I'm just starting with React and this is really my first application, although I work with a team in a project that already have a lot of react. I expect to become more proficient in React to really be able to work on that project. Keep the good work, I hope you get a lot of subscribers soon.

    • @cosdensolutions
      @cosdensolutions  Před rokem +1

      Really happy to hear that dude! You're going to do great ☺️ thank you for the kind words!

    • @reallegendcode
      @reallegendcode Před 7 měsíci

      @@cosdensolutions please when are going to do a video on HOC

  • @jijocleetus
    @jijocleetus Před 6 měsíci

    Great one with context, i like the way you handled the undefined scenario. Thanks for the tutorial.

  • @shawn.builds
    @shawn.builds Před 3 měsíci

    been loving the react tutorials man! dont think anyones ever explained context so simply :)

  • @AntNZ
    @AntNZ Před rokem +11

    Wow! Such a excellent explanation and with examples too. Well done 👏👏👏👏

  • @soduno596
    @soduno596 Před 2 měsíci

    you where one of the only youtubers who actually got me to subscribe to your channel. Nice way of implementing the idea 😃. And fantastic tutorials, crystal clear.

  • @jay-kv6wn
    @jay-kv6wn Před rokem +6

    I hope your videos go viral soon like they should. You are doing a great work with your explanations

    • @cosdensolutions
      @cosdensolutions  Před rokem

      Haha imagine going viral for React 😅 would love it!

  • @Chris-by8tg
    @Chris-by8tg Před 6 měsíci

    This was the clearest explanation I've seen. Thank you!

  • @_romeopeter
    @_romeopeter Před 2 měsíci

    This was straight forward. Thank you for throwing in the extra error handling method as well 🔥

  • @user-gm3lg8gp3m
    @user-gm3lg8gp3m Před rokem +3

    I subscribed!! This is a great way to explain the concept + thanks for adding the error handling part 👍

  • @garudaphoenix5479
    @garudaphoenix5479 Před rokem +5

    Thanks for this great and clear explanation with a lot more edges. Hope you will get 1 million subs soon. Tbh, You deserve it.

  • @wekesirken6961
    @wekesirken6961 Před 6 měsíci

    That was some good explanation, you made contexts seem obvious...Appreciated

  • @sub_in01
    @sub_in01 Před 11 měsíci +1

    Bro I really love your content and I learn a lot from you, don't worry about subscribers, they will ultimately come to you as your way of explaining is so very good. Keep uploading contents.

  • @YisneySoto
    @YisneySoto Před 10 měsíci +2

    Great, thanks. It's my first Context video and I think I got it at the first time because it's so well explained, of course having used Redux before makes this easier to understand.

  • @franbrankovic3617
    @franbrankovic3617 Před 10 měsíci

    After this video you really don't need to watch another video about react useContext. This was excellent video.

  • @XXlikeabauss
    @XXlikeabauss Před 11 měsíci +1

    Really helpful video, thank you so much!

  • @AhmedHuzain
    @AhmedHuzain Před 7 měsíci

    "If you watch this hook video, you'll probably never need to watch another"
    This is so true! You explain it so well. Thank you!

  • @fg0611
    @fg0611 Před měsícem

    Bro thank you for this video! amazing. I have an interview in 1 hour and it's main thing is knowing about react context!

  • @vampirekabir
    @vampirekabir Před rokem

    trying to get a grasp of it,nobody taught like u did,i finally get it now ❤❤

  • @ooorayooonyoooo
    @ooorayooonyoooo Před rokem

    A really underrated channel, well done bro! ⚡❤

  • @sudiptobose8296
    @sudiptobose8296 Před 4 měsíci

    Fantastic tutorial. I really appreciate it. 😊

  • @kwasiezor1630
    @kwasiezor1630 Před rokem +1

    Thanks for the video bro. Simplified explanation always makes understanding better 😊

  • @antimrevapati8992
    @antimrevapati8992 Před 5 měsíci

    Great Explanation, Thank you!

  • @ThomasKanzig
    @ThomasKanzig Před 10 měsíci +1

    Amazing tutorial.
    Thanks a lot.

  • @user-ms4cs3cb4w
    @user-ms4cs3cb4w Před 7 měsíci +1

    Thanks it was very helpful

  • @jeandedieuiradukunda6079

    that's incredibly explained, thank you sir

  • @RyS29
    @RyS29 Před 8 měsíci +1

    Great content, thank you!

  • @sathirabandara7981
    @sathirabandara7981 Před 6 měsíci

    Great job man. its very helpful !!

  • @theppiwatkomolwat4429
    @theppiwatkomolwat4429 Před 8 měsíci

    1:31 This part of the code worked; I have now subscribed!

  • @Aiexpertise-ft9ec
    @Aiexpertise-ft9ec Před měsícem

    I grabs those points clearly, thanks dude.

  • @user-bk2ts2zc3r
    @user-bk2ts2zc3r Před měsícem

    thanks man I really understood it. Subscribed already

  • @mchisolm0
    @mchisolm0 Před 3 měsíci

    Definitely appreciate your attention to detail and have earned my sub. You helped me understand how I was having trouble with a boilerplate I use that has a useState inside a useEffect. I understand *what* the problem is now (thank you for that video), but I can't figure out what I need to learn to solve it. Thanks for at least helping me get closer.

  • @myothiha1168
    @myothiha1168 Před 11 měsíci +1

    best explanation ever!🤩

  • @mostinho7
    @mostinho7 Před měsícem +1

    Done thanks!
    Wrap useContext hook in a custom hook to handle when the context is null (if component didn't have provider up in the tree when it should have and tried to use the context hook)

  • @rmc1579
    @rmc1579 Před 7 měsíci

    great explanation. I was a little bit confuse when using context and how to implement them.

  • @Teddyrobinson
    @Teddyrobinson Před 5 měsíci

    Another great tutorial thanks so much!

  • @santiagovelezsaffon
    @santiagovelezsaffon Před 3 měsíci

    Very well explained !!

  • @mgx49
    @mgx49 Před 4 měsíci

    No doubt I won't need to watch another React Context API video! [Subscribed]

  • @UnfinishedYara
    @UnfinishedYara Před 5 měsíci

    Thanks man! Crystal clear now!

  • @reallegendcode
    @reallegendcode Před 8 měsíci

    Top-notch explanation. Manifesting 100k subscribers by end of this year

  • @simplebutcorrect6176
    @simplebutcorrect6176 Před 9 měsíci

    Bro I love the way that you explain keep it up. Subscribed❤

  • @samahgad241
    @samahgad241 Před 7 měsíci

    Realy great explanation,thank you

  • @Shaheer-xs5os
    @Shaheer-xs5os Před 11 měsíci

    That was such an awesome explanation 👍

  • @glenmccallum7051
    @glenmccallum7051 Před 10 měsíci +1

    Thanks a lot, this was really helpful. Really great video and great channel

  • @admasterefe4340
    @admasterefe4340 Před 3 měsíci +1

    GOD level explanation. I want everyone to subscribe to this channel. Too bad one can't give two likes.

  • @tokaqarcivadze5825
    @tokaqarcivadze5825 Před 9 měsíci

    the way you explain react is the best!

  • @Jack-ps4jg
    @Jack-ps4jg Před měsícem

    really nice and simple explanation thank you for making this video

  • @HerlonCosta
    @HerlonCosta Před 8 měsíci

    I reall like this explanation. You're very good, god bless you!

  • @cypherop2608
    @cypherop2608 Před 6 měsíci

    you made it soooooo easy to understand

  • @thebeastsclips
    @thebeastsclips Před 7 měsíci +3

    useContext is a great alternative for a bunch of prop drilling with a bunch of useStates as well in the child component as well.

  • @leonardmbibi8013
    @leonardmbibi8013 Před 10 měsíci

    Top notch! You're the man

  • @israelkayaba6002
    @israelkayaba6002 Před 7 měsíci

    Thanks bro, much appreciated !

  • @deshannawarathna6283
    @deshannawarathna6283 Před 6 měsíci

    Thank you man. That is good explanation

  • @sup_nim
    @sup_nim Před 11 měsíci

    great explaination thank you bro!

  • @vivekkumar-pc1xy
    @vivekkumar-pc1xy Před 7 měsíci

    Crystal Clear... Thanks

  • @marceloleoncaceres6826
    @marceloleoncaceres6826 Před 6 měsíci

    Great video, thanks for sharing your time and knowledge,

  • @shivasai7707
    @shivasai7707 Před 2 měsíci

    great explaination on useContext

  • @codehustler8582
    @codehustler8582 Před 4 měsíci

    Amazing Channel for Learning React

  • @poornasaipilla1620
    @poornasaipilla1620 Před 5 měsíci

    Really use full video thanks for doing ... extending my great full and encouragement .... keep doing well..

  • @Temefaa
    @Temefaa Před 4 dny

    Great tutorial thanks !

  • @ihebbenaicha1353
    @ihebbenaicha1353 Před rokem

    please keep it up with more hooks and thank you !

  • @juststudying1019
    @juststudying1019 Před 6 měsíci

    Amazing channel, thanks.

  • @user-wq9xz9yc7c
    @user-wq9xz9yc7c Před 8 měsíci

    I speak another language, but I'm happy to find this video. Thanks!

    • @cosdensolutions
      @cosdensolutions  Před 8 měsíci

      Working on adding translated captions to all videos soon!

  • @mboe94
    @mboe94 Před 7 měsíci

    That subscribe intro you did made me subscribe. Genius.

  • @awasum
    @awasum Před 5 měsíci

    Thank you very much. Good content

  • @syedayanata9765
    @syedayanata9765 Před 10 měsíci

    I watched many videos and still did not understand context but this video helped me a lot.

  • @user-el9ui5jk5m
    @user-el9ui5jk5m Před 4 měsíci

    I literally subscribed after seeing your message in the Video

  • @omkarjagtap2212
    @omkarjagtap2212 Před 5 měsíci

    man, awosome video crystel clear concepts and learned how to write a more safe code(in the pov for debugging)

  • @Atomatiz
    @Atomatiz Před 7 měsíci

    Cosden. I love you bros 😉

  • @himago
    @himago Před 22 dny

    nicee, it works now i'm subscribed

  • @safareesamuels4674
    @safareesamuels4674 Před 8 měsíci

    Home of React well explained Tutorials

  • @abdoseadaa
    @abdoseadaa Před 6 měsíci

    i put like b4 watching your videos :)
    legend

  • @Vishal360
    @Vishal360 Před 10 měsíci

    loved ur react tuts.... 🔥🔥🔥🔥🔥🔥🔥🔥

  • @brunopagno
    @brunopagno Před 9 měsíci

    Nice video!

  • @yusha790
    @yusha790 Před 2 měsíci

    You're the best man

  • @Bilo_7
    @Bilo_7 Před 11 měsíci

    I made an instant subscription 👍

  • @moppnitz
    @moppnitz Před měsícem

    man.. this is a lot to wrap my head around

  • @brNoMundo123
    @brNoMundo123 Před 5 měsíci

    Sou desenvolvedora Júnior e seus vídeos estão me ajudando muito a me desenvolver 🚀

  • @suvakshaacharya6900
    @suvakshaacharya6900 Před 4 měsíci

    thanks . helped a lot

  • @PravinsPhotos
    @PravinsPhotos Před 6 měsíci

    I really did subscribe at 1:57...good one there😂

  • @shekhtausif2811
    @shekhtausif2811 Před rokem +2

    Just make more videos like this on react plz you explain really well

  • @Fleischmann773
    @Fleischmann773 Před 10 měsíci

    Great example!!!

  • @rasikakshirsagar5563
    @rasikakshirsagar5563 Před 5 měsíci

    Thank you bro!

  • @KENNY-sm8mp
    @KENNY-sm8mp Před 26 dny

    thank you for this

  • @mjylove2
    @mjylove2 Před měsícem

    great explanation

  • @MarksmanVallecillo
    @MarksmanVallecillo Před 10 měsíci

    Thanks, man very good video. 10 Stars ⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐

  • @theGameThrough
    @theGameThrough Před rokem +3

    It would be suggested to put some console log and also the UI just to make it more clear would be a lot helpful too thanks

  • @mark-broomfield
    @mark-broomfield Před 8 měsíci

    Great tutorial thanks. My subwoofer got a serious workout every time you banged the mic though :-)

    • @cosdensolutions
      @cosdensolutions  Před 8 měsíci

      LOL 😂 it gets better in later videos I promise!!!

  • @MRNani-rw6td
    @MRNani-rw6td Před 2 měsíci

    Thank for this

  • @inspacesilence
    @inspacesilence Před měsícem

    1:37 if you really want user to get you subscribed create content which user want to watch again and again, most of us won't subscribe but still hit a like button just because we know this video is great and we can come back to you by searching you, to be in our feed create something which we want to see on daily basis and these things are not one watches on daily basis... this is just a advice... you gained 1 subscriber

  • @anhmap9055
    @anhmap9055 Před měsícem

    ok lắm anh trai đẹp zai ơi, em mới học mót không học chính thức, ban đầu em đi móc A => B => C => D, bây giờ thì móc A => D )))

  • @niconel7659
    @niconel7659 Před 9 měsíci

    Thanks for the reminder to subscribe. Guilty as charged, but subscribed now.