Learn React Hooks: useContext - Simply Explained!

Поділитися
Вставка
  • Опубліковано 24 тра 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!

КОМЕНТАРІ • 244

  • @cosdensolutions
    @cosdensolutions  2 місяці тому +3

    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

  • @mikoajkulczynski5213
    @mikoajkulczynski5213 7 місяців тому +17

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

  • @GeraldPajulas
    @GeraldPajulas 5 місяців тому +6

    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.

  • @osmankain1508
    @osmankain1508 2 місяці тому +5

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

  • @shubhankarvalimbe5286
    @shubhankarvalimbe5286 8 місяців тому +17

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

  • @HR-pz7ts
    @HR-pz7ts 3 місяці тому +5

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

  • @Chris-by8tg
    @Chris-by8tg 4 місяці тому

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

  • @user-sy5fd7kn8w
    @user-sy5fd7kn8w 2 місяці тому +1

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

  • @AntNZ
    @AntNZ Рік тому +10

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

  • @shawn.builds
    @shawn.builds Місяць тому

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

  • @jay-kv6wn
    @jay-kv6wn Рік тому +6

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

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

      Haha imagine going viral for React 😅 would love it!

  • @camilotorresf1
    @camilotorresf1 Рік тому +24

    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  Рік тому +1

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

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

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

  • @marshallfungai3033
    @marshallfungai3033 5 місяців тому +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.

  • @user-gm3lg8gp3m
    @user-gm3lg8gp3m 10 місяців тому +3

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

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

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

  • @garudaphoenix5479
    @garudaphoenix5479 11 місяців тому +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.

  • @soduno596
    @soduno596 20 днів тому

    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.

  • @_romeopeter
    @_romeopeter 24 дні тому

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

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

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

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

    Amazing tutorial.
    Thanks a lot.

  • @XXlikeabauss
    @XXlikeabauss 10 місяців тому +1

    Really helpful video, thank you so much!

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

    Fantastic tutorial. I really appreciate it. 😊

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

    Great Explanation, Thank you!

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

    Very well explained !!

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

    Thank you man. That is good explanation

  • @user-ms4cs3cb4w
    @user-ms4cs3cb4w 5 місяців тому +1

    Thanks it was very helpful

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

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

  • @sub_in01
    @sub_in01 9 місяців тому +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.

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

    Great job man. its very helpful !!

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

    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.

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

    Thanks bro, much appreciated !

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

    Another great tutorial thanks so much!

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

    Realy great explanation,thank you

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

    the way you explain react is the best!

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

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

  • @vivekkumar-pc1xy
    @vivekkumar-pc1xy 6 місяців тому

    Crystal Clear... Thanks

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

    A really underrated channel, well done bro! ⚡❤

  • @user-bk2ts2zc3r
    @user-bk2ts2zc3r День тому

    thanks man I really understood it. Subscribed already

  • @myothiha1168
    @myothiha1168 10 місяців тому +1

    best explanation ever!🤩

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

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

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

    Amazing Channel for Learning React

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

    you made it soooooo easy to understand

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

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

  • @YisneySoto
    @YisneySoto 8 місяців тому +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.

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

    Amazing channel, thanks.

  • @RyS29
    @RyS29 6 місяців тому +1

    Great content, thank you!

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

    "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!

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

    Thanks man! Crystal clear now!

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

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

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

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

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

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

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

    Thank you very much. Good content

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

    great explaination on useContext

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

    great explaination thank you bro!

  • @Shaheer-xs5os
    @Shaheer-xs5os 10 місяців тому

    That was such an awesome explanation 👍

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

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

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

    Context API with a custom hook, so well explained. Thank you.
    {2023-10-16}

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

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

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

    Great video, thanks for sharing your time and knowledge,

  • @user-el9ui5jk5m
    @user-el9ui5jk5m 2 місяці тому

    I literally subscribed after seeing your message in the Video

  • @thebeastsclips
    @thebeastsclips 6 місяців тому +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.

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

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

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

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

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

    Top notch! You're the man

  • @yusha790
    @yusha790 27 днів тому

    You're the best man

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

    Cosden. I love you bros 😉

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

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

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

    Home of React well explained Tutorials

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

    thanks . helped a lot

  • @Martin-xf8be
    @Martin-xf8be 6 місяців тому

    That subscribe intro you did made me subscribe. Genius.

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

    i put like b4 watching your videos :)
    legend

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

    Thank you bro!

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

    please keep it up with more hooks and thank you !

  • @user-wq9xz9yc7c
    @user-wq9xz9yc7c 6 місяців тому

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

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

      Working on adding translated captions to all videos soon!

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

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

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

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

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

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

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

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

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

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

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

    Nice video!

  • @MRNani-rw6td
    @MRNani-rw6td 28 днів тому

    Thank for this

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

    I made an instant subscription 👍

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

    Thanks a lot.

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

    Great example!!!

  • @theGameThrough
    @theGameThrough 11 місяців тому +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

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

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

  • @mai.krishnahoon
    @mai.krishnahoon 4 місяці тому +1

    Thanks from india..

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

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

  • @antoninosartori
    @antoninosartori 7 місяців тому +2

    And what if User comes from a fetch? Do you put in on the custom hook? How would you handle errors? Thanks for the video

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

      If user come from server state, don't throw error in custom hook, just return user.

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

    grouse wrapping the context in a hook. You can build up the provider with state & mutators and pass that to the value of the provider. There's no need to wrap the context with hook jank to extend the context -> with a wrapped hook A) you're not enforce access & mutations B) you also have an extra shit tonne of renders as the hook runs through state changes in every component C) you remove the useContext which hides the fact the component is consuming global/shared state.

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

    realy thank you but i have a question please which better using context api or redux tookit

  • @mark-broomfield
    @mark-broomfield 6 місяців тому

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

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

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

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

    Thank you

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

    Thanks 🙏😊

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

    Thanks for making in ts

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

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

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

    thank you

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

    now i subscribed ;)

  • @user-dm3sf9mk2o
    @user-dm3sf9mk2o 8 місяців тому

    This was a really good explanation. Would you consider doing a video about useContext in regards to forms?

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

      sure!

    • @user-dm3sf9mk2o
      @user-dm3sf9mk2o 7 місяців тому

      @@cosdensolutionsI get stuck on passing input content to the page. Trying different ways without too much success.

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

    Cant subscribe but here is my thumbs up 👍