React Hooks useContext Tutorial (Storing a User)

Sdílet
Vložit
  • čas přidán 27. 07. 2024
  • Learn how to use the useContext hook in React to store and access a user.
    Code: github.com/benawad/react-hook...
    Playlist: • React Hooks Tutorial
    ----
    If you like cooking, checkout my side project: www.mysaffronapp.com/
    ----
    Join the Discord: / discord
    ----
    Patreon: / benawad
    ----
    Follow Me Online Here:
    Twitch: / benawad
    GitHub: github.com/benawad
    LinkedIn: / benawad
    Instagram: / benawad97
    Twitter: / benawad
    #benawad
    TikTok: / benawad ​

    ----
    Follow me online: voidpet.com/benawad
    #benawad
  • Věda a technologie

Komentáře • 372

  • @010timeboy27
    @010timeboy27 Před 4 lety +203

    My face after you mentioned the F2 tip 😲

  • @ozzyfromspace
    @ozzyfromspace Před 2 lety +27

    I finally appreciate the logical flow from app state to context to context.provider. You absolutely rock, Ben! Thank you 😎👏🏽🔥

  • @GeordyJames
    @GeordyJames Před 4 lety +7

    I watched the entire hooks playlist and this is the best react hooks video I ever watched. Thanks for creating...

  • @VRtualboy
    @VRtualboy Před 3 lety

    Thank you for this tutorial! I have been stuck for the past week trying to figure out how to pass details of an authenticated user to other components. This is just what I needed, a clear and easy to follow explanation.

  • @SumeetChawla
    @SumeetChawla Před 4 lety +75

    This was such an amazing demo. Clear and to the point!

  • @dockies
    @dockies Před rokem +1

    I've been struggling with this so much that I have to watch 7 videos regarding this topic and all it did is make me more confused. But your less than 15 minute video made me understand what it is and how to use it exactly. Kudos to you!

  • @Frazful
    @Frazful Před 2 lety +1

    I love how you use simple ass components on your tutorials. Less boiler plate, straight to the point.

  • @MrMarbles320
    @MrMarbles320 Před 4 lety +26

    EXACTLY what I was looking for, very well made, thank you!

  • @mokroargra7277
    @mokroargra7277 Před 3 lety

    You saved me! I was struggling with getting data from one file to another and understanding context but as soon as I saw you setting state and using / setting state in other components / files, it all clicked. Was able to finish converting my vanilla JS app to React. Thank you!

  • @tiagosbrito
    @tiagosbrito Před 4 lety +35

    The best tutorial/explanation I ever got from the web, straight to the point, with useful content. Thanks for sharing your knowledge.

  • @mtsurov
    @mtsurov Před rokem

    I like that this is not just an explanation of hook syntax, but a practical application of it.

  • @LewisCampbellTech
    @LewisCampbellTech Před 4 lety +1

    It's friday afternoon here, brain has had enough. I tried reading the react docs a few times, read a few blogs, but this video made it click. Nice work.

  • @Jake66564
    @Jake66564 Před 3 lety +4

    Exactly what I needed, thanks! Helped me clean up some junky Stack Overflow suggestions that weren't working properly.

  • @arthurswanson3285
    @arthurswanson3285 Před 3 lety +21

    Passing setUser as a context so that children can update parent contexts is an awesome pattern.

  • @abhishekghadge7543
    @abhishekghadge7543 Před 3 lety +2

    The whole series has been so helpful for me. Thanks a lot for creating such awesome videos!

  • @sanhitabiswas1171
    @sanhitabiswas1171 Před 2 lety +2

    Thanks a lot Ben. You have explained it so nicely . I have searching for session management in React and you made my journey so easy. Thanks again !!

  • @AnanyaSingh-jq8pp
    @AnanyaSingh-jq8pp Před 2 lety +1

    Thank you so much for explaining it so well. I was having a hard time using the useContext hook, you made it super easy. Thanks a lot!

  • @sumitmehra5119
    @sumitmehra5119 Před 2 lety

    Bro. I've been struggling with react hooks like context, memo and other. Now usecontext is out of the list. Thanks to you. 👑👑

  • @mohamadybr
    @mohamadybr Před 3 lety

    That explained a lot and helped me to clear my mind about this topic. Much appreciation! A very clear and well-explained video without any extra unnecessary info!

  • @alanhunt3772
    @alanhunt3772 Před 3 lety +2

    Great video, Ben. I've been back and forth between this video and Web Dev Simplified's useContext tutorial and yours drove it home a little bit better with the practical login example- which is exactly what I'm doing in my project right now. Plus you threw in useMemo as a bonus- props!

  • @DEADSTEP12
    @DEADSTEP12 Před 3 lety

    Couple days into developing my app and this is exactly what I needed!!! Thanks!

  • @Ashnaflavdjov
    @Ashnaflavdjov Před 2 lety

    you saved me... from doing it the old way that is, started learning hooks yesterday and i see how usefull they are, love your content man

  • @CalebDiT
    @CalebDiT Před rokem

    You did a great job of making it look easy. Or, put another way, you did a great job of clearing the smoke around something that isn't as complicated as I thought it was.
    Many thanks.

  • @leshle1
    @leshle1 Před 3 lety

    Excellent overview. Not too much, just enough to understand the concept so that I can utilize it. Really good job!!

  • @justACasualProgrammer
    @justACasualProgrammer Před 2 lety

    I'm having trouble with this type of hook, your explanation and examples are very clear and simple. thank you so much!

  • @luisantoniojachozambrano7605

    11 minutes of pure gold, thank you Ben.

  • @jamesnguyen868
    @jamesnguyen868 Před 5 lety +3

    awesome video Ben, keep up the great work

  • @shark5749
    @shark5749 Před 4 lety

    Thank you! Have been stuck on react hooks for days!

  • @noelcovarrubias7490
    @noelcovarrubias7490 Před 3 lety

    I was having a little bit of trouble understanding this but I no longer have it. I love you man!

  • @CarlitoProductions
    @CarlitoProductions Před 3 lety

    Awesome! This helped tons with saving settings. I was prop drilling before but this hook saved my behind. Thanks!

  • @bulldawggy123
    @bulldawggy123 Před 3 lety

    This was amazing! So helpful. Exactly what I have been crying about. So grateful to you.

  • @raymondmichael4987
    @raymondmichael4987 Před 2 lety

    Two year later, I'm watching this, I wonder why it have such a low viewers count, looks some hooks are missing.
    This is real great, no bullshits or styles confusions.
    Greetings from Tanzania 🇹🇿

  • @yosoyhim
    @yosoyhim Před rokem

    Lifesaver. Been trying to find a simple example that I can follow and you did it! thank you

  • @nelbabarreto6451
    @nelbabarreto6451 Před 4 lety +1

    Thank you! Exactly what I was looking for 🙌

  • @HarisKhan-bh6uj
    @HarisKhan-bh6uj Před rokem

    one of the clearest explanation on useContext out there !

  • @AnhTu-en9gk
    @AnhTu-en9gk Před 2 lety +1

    this is the easiest context tutorial so far. Thank you

  • @user-qk4tx9jc4m
    @user-qk4tx9jc4m Před 4 lety +1

    wow... this is the cleanest example of useContext!

  • @DiestroCorleone
    @DiestroCorleone Před 2 lety

    Dude, this was awsome. I've seen lots of videos that overcomplicate the whole thing. After 5 minutes of your video, I already implemented useContext in an app I'm working in and it just saved me a lot of headaches. Thank you!
    WAIT A MINUTE. It's Ben Awad! How didn't I notice? And why am I not subscribed? I could swear I was. Well, guess you've (re)gained a subscriber.

  • @viktorlnt7835
    @viktorlnt7835 Před rokem

    Now I understand why the algorithm kept recommending this guy, it was cool to watch him code

  • @mmmiyoung
    @mmmiyoung Před 4 lety +7

    This really helped me out. Thank you for taking the time to make this video. Real MVP.

  • @marcusaureliusregulus2833

    Understood. Thanks. Also the sound of you typing is so satisfying😂

  • @aliosman975
    @aliosman975 Před 3 lety

    I was litterally looking for something like this thank you ❤️

  • @rjsalamanca7534
    @rjsalamanca7534 Před 4 lety +1

    Great tutorial, going to implement this on a personal project.

  • @AkshatSinghania
    @AkshatSinghania Před 3 lety

    best tut for react context on the planet , btw that mention of use memo took me to your another tut for usememo then it took me to useState , noice recursive videos

  • @mtcindianutube
    @mtcindianutube Před 4 lety

    Thank you Ben, great learning in quick time

  • @Alphfirm
    @Alphfirm Před 3 lety

    Thanks so much! Best tutorial on context, I finally understood it now. Not too quick.

  • @stoicnash
    @stoicnash Před rokem

    Best demo ive seen, really nailed it!!!

  • @devyadav0399
    @devyadav0399 Před 2 lety

    The only video that was able to help me. You're a godsend. Keep it up brother.

  • @davidbuyinza2651
    @davidbuyinza2651 Před 3 lety

    You just made everything so easy. Thanks Ben.

  • @supermanbrz
    @supermanbrz Před 2 lety

    Without a form, you explained better than anyone else

  • @Speeds6080
    @Speeds6080 Před 3 lety

    Best explanation ever !
    So clear and helped me out heaps !
    Thanks Ben

  • @clarkdnro
    @clarkdnro Před rokem

    Benawad, you re good in programming. Totu keyboard typing and explanations sayit all. NICE

  • @marco114
    @marco114 Před 3 lety

    This was the best explanation i have seen so far, thanks.

  • @lloydschneck4141
    @lloydschneck4141 Před 3 lety

    Extremely helpful video! Thanks so much for such a simple and effective example 🙏🏼🙏🏼

  • @lnhh
    @lnhh Před 2 lety

    Such a great and concise demo, even in 2022!

  • @margaridalopes5810
    @margaridalopes5810 Před 3 lety

    Just want to say that you just saved me!
    You're the best Ben!!!
    Thank you very much

  • @sayanadhikary1682
    @sayanadhikary1682 Před 2 lety

    The concept of ContextAPI became so much clearer for me as a noob in React.

  • @DairoPortillo
    @DairoPortillo Před 4 lety

    Thank you! Exactly what I was looking for.

  • @dangre00
    @dangre00 Před 3 lety +1

    This is the most beautiful useContext explanation on youtube. Sorry Kyle at WDS :(

  • @TyrannosaurusTroy
    @TyrannosaurusTroy Před 2 lety

    Thank you so much for this tutorial! It helped the useContext hook finally click for me.

  • @jialiliang3606
    @jialiliang3606 Před 2 lety

    Really enjoyed learning from your video! Nice work!!

  • @MLGMondo
    @MLGMondo Před 2 lety

    Very clear explanation and straight to the point. Thanks a lot.

  • @clement3072
    @clement3072 Před 2 lety

    Hey, currently learning react I love your work and your amazing videos thanks man 👍

  • @nazrinibrahimli7042
    @nazrinibrahimli7042 Před rokem

    This is the best explanation I have ever seen!

  • @pawzubr
    @pawzubr Před 5 lety +108

    `createContext` does not take initial value - it takes the value that is provided when you try to use this context with no provider.

    • @PrashanthPuranik
      @PrashanthPuranik Před 4 lety +7

      Wow. I have been searching for this answer for a long time. I wish the documentation would state that clearly and upfront.

    • @juliohintze595
      @juliohintze595 Před 4 lety

      Awesome tip!

    • @jjanchovi8568
      @jjanchovi8568 Před 3 lety

      so its like a default value?lets say i dont add a value in the provider , then it will use whatever its in createContext? in Ben`s example - null.

    • @juliohintze595
      @juliohintze595 Před 3 lety +1

      I was thinking about this... Why should we use a context with no provider?

    • @KanecoV
      @KanecoV Před 3 lety

      @@jjanchovi8568 yes, it's like a default value

  • @yasser.dev7
    @yasser.dev7 Před 3 lety

    Amazing explanation, thanks Ben

  • @joshuaheathcote2116
    @joshuaheathcote2116 Před rokem

    Straight to the point. Real nice.

  • @logicmonster6197
    @logicmonster6197 Před rokem

    my man is straight to the point thanks

  • @prathampatel6357
    @prathampatel6357 Před 2 lety

    as clear as I was looking for, thank you very much

  • @stoic2454
    @stoic2454 Před 3 lety

    Exactly the thing i was looking for, thanku so so much ben!!!

  • @Scottni2
    @Scottni2 Před 3 lety

    Excellent info and walkthrough, thank you sir!

  • @manolismakris5836
    @manolismakris5836 Před 3 lety

    Thank you for precious time and for the tips!

  • @hamaadfahim2916
    @hamaadfahim2916 Před rokem

    Not only did he teach me useContext.. mans taught me useMemo. Best explanation

  • @DerekBraid
    @DerekBraid Před 4 lety

    Video is very well done, thanks for sharing the knowledge!

  • @rohandevaki4349
    @rohandevaki4349 Před 3 lety

    Very nice informative video, I am doing a revision of react and redux, and i am revising with your tutorials.

  • @rakeshb2010
    @rakeshb2010 Před 2 lety

    Simple and easy to understand. Thank you.

  • @chideraachinike7619
    @chideraachinike7619 Před 3 lety

    Awesome! Thanks for this, it helped a lot!
    Much love! ❤️

  • @modern_sapien
    @modern_sapien Před 3 lety

    Yo, great straightforward and to the point video. Wonderful for review and for new learners alike, or if you're like me somewhere in between!
    Great job!
    Also, f2 didn't work on my windows machine.

  • @ncesar
    @ncesar Před 4 lety

    Very well explained, thanks!

  • @KrishnaKumar-jr7qq
    @KrishnaKumar-jr7qq Před 4 lety

    Thats a great explanation man .. Hats off to you !!

  • @adegokeayobamiseun728

    Exactly what i need. Thanks ben

  • @danpetre5414
    @danpetre5414 Před 4 lety

    Very good explanation. Thanks Ben. :)

  • @jefersoncosta2621
    @jefersoncosta2621 Před 4 lety

    This was awesome! Thanks a lot!

  • @ergceme
    @ergceme Před rokem

    it was a clear vid to learn basics of using context. thanks

  • @natewalchenbach8413
    @natewalchenbach8413 Před 2 lety

    Such a good explanation. Thank you!!!

  • @souta_tran
    @souta_tran Před 4 lety

    super useful, thanks for your work.

  • @webdeveloper1922
    @webdeveloper1922 Před 2 lety

    It was clear and out of making any confusion

  • @expectations2188
    @expectations2188 Před rokem

    You are awesome Ben. You explained it so well. Thank you :)

  • @aishwaryasrivastava3682

    Wow ...you made it so easy. Big thanks from a beginner :)

  • @igorferreira5704
    @igorferreira5704 Před rokem

    simple but accurate. it's what i needed. thanks!

  • @abdullahch8535
    @abdullahch8535 Před 3 lety

    BEST useContext Tutorial

  • @jseyfert
    @jseyfert Před 2 lety +1

    clear concise and perfect!

  • @whonayem01
    @whonayem01 Před 2 lety

    You made it crystal clear!

  • @serayaexiste
    @serayaexiste Před 3 lety

    Very well explained! Thanks

  • @sstawecki
    @sstawecki Před 2 lety

    Thanks for the quick lesson. Buen finde.

  • @daydreameravani
    @daydreameravani Před rokem

    Thanks a lots , exactly what I am looking for.

  • @zedsmelee
    @zedsmelee Před rokem

    Thank you so much, this really helped me out massively.

  • @fabikay3806
    @fabikay3806 Před 3 lety

    Great video dude

  • @MrJatan90
    @MrJatan90 Před 3 lety

    amazing tutorial, thank you so much!

  • @vladislavishe
    @vladislavishe Před rokem

    Great! Thanks you! Best explain of context that i have seen.