UseContext Hook Tutorial In ReactJS | Global States

  Рет қаралды 32,918

PedroTech

PedroTech

Күн бұрын

In this video I teach you guys how to use the UseContext hook from the React context api to create Global States. This is a very useful hook that can be used in many different situations. Using this together with the UseState hook allows cross component state management!
-
Please leave a comment on what topic you guys want me to cover next!
Checkout my discord for any questions: / discord
-
SUBSCRIBE!
Social
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Website: machadopedro.com
Twitter: / pedrotech_
Linkedin: / machadop1407
Instagram: / _pedro.machado_
Github: github.com/mac...
Email: machadop1407@gmail.com

Пікірлер: 69
@LearnUp..
@LearnUp.. Жыл бұрын
I never understood CONTEXT as a beginner until I watch your video, thanks for making it simple to understand.
@metinkucuk734
@metinkucuk734 Жыл бұрын
Pedro thank you billion times!! As a newbie in React I couldn't find any simple video that talking about useContext from scratch. Even in the channels with millions of followers. Thanks to your video I got the hang of it. Keep up the good work:)
@firepup9924
@firepup9924 2 жыл бұрын
I was stuck trying to change useState in a child component all day. But then found this video. Thank you so much now I realized I have to learn all those hooks :D
@nikolatesla399
@nikolatesla399 8 ай бұрын
Hey , iam contributing to an open source project that is using react as their frontend , this video is soooooo helpful❤
@karimkazia
@karimkazia 3 жыл бұрын
Well this just saved me a ton of work , i am integrating with Django REST API.. Thank you.. simple but will help alot!!!
@PedroTechnologies
@PedroTechnologies 3 жыл бұрын
Awesome! Context API is one of the coolest things I learned while working with react! State management used to be something I thought react lacked but using this changed my mind.
@satyaganesh672
@satyaganesh672 2 жыл бұрын
broo ur explanation skils are awersome.;.. u really saved me man 🙌🙌🙌🙌🙌🙌🙌🙌🙌🙌
@tharun5439
@tharun5439 Жыл бұрын
Thanks a lot bruhhhhhhh...i simply cant explain my gratitude in words...
@bastienv6233
@bastienv6233 Жыл бұрын
your video is so perfect ! Your english is very good and simple enough for non english speaker and beginer. Thank you so much for all of your content.
@daviddriscoll8546
@daviddriscoll8546 Жыл бұрын
This is a really nice, clear explanation. Great work (as always) Pedro!
@edgarzatarain6535
@edgarzatarain6535 2 жыл бұрын
your videos always help me when im having problems, keep the videos coming!
@minok7374
@minok7374 2 жыл бұрын
Muito legal ver um brasileiro produzindo esse tipo de conteudo! Parabens pelo canal cara, mais um inscrito!
@rvft
@rvft 2 жыл бұрын
never thought legal would mean cool in portuguese
@minok7374
@minok7374 2 жыл бұрын
@@rvft It does kkkkk
@patrickwainaina2104
@patrickwainaina2104 Жыл бұрын
Very clearly outlined, you nailed it brother Thanks a lot
@broken_jail2506
@broken_jail2506 Жыл бұрын
Thanks so much for this tutorial, so so helpful!
@tinotaylor
@tinotaylor 2 жыл бұрын
This was great Pedro. Perfectly simple 👌🏼
@ca-xo2ur
@ca-xo2ur 2 жыл бұрын
Great explanation for a refresher thank you so much!
@samnayakawadi
@samnayakawadi 2 жыл бұрын
You explained it very well. Thanks.
@mitch1668
@mitch1668 Жыл бұрын
Hey Pedro, what add-on do you have that automatically loads the useContext at the top when you type it within the function? (6:03)
@learnwithjoe8117
@learnwithjoe8117 2 жыл бұрын
So much better explained! Thanks!!
@Sanyat100
@Sanyat100 3 жыл бұрын
Ur video s are the best compared to all the others
@PedroTechnologies
@PedroTechnologies 3 жыл бұрын
Thank you for the positive message!
@Bertoos8
@Bertoos8 2 жыл бұрын
Obrigado Pedro 🙏 Mais uma vez!
@blagovestkolev7716
@blagovestkolev7716 2 жыл бұрын
Great! Very useful to me! Keep making videos the same way (your way) !
@michaelodikanwa442
@michaelodikanwa442 2 жыл бұрын
Good work here, PedroTech.
@tomasburian6550
@tomasburian6550 3 ай бұрын
This doesn't work. When the page opens, the context is still an empty object as you defined. The values aren't filled in.
@gayanhewegeonline4594
@gayanhewegeonline4594 3 жыл бұрын
We love you man!
@vivekpadelkar
@vivekpadelkar 2 жыл бұрын
great work bud!!!!!!!!!!!! keep going....subscribing your channel....
@purvaparulekar-zq2ck
@purvaparulekar-zq2ck 3 ай бұрын
How can I import useContext variable in a react file which does not have functional compoent.
@517Amit
@517Amit 3 жыл бұрын
Nice. Thanks for this informative video.
@DineshSainath
@DineshSainath 2 жыл бұрын
What do I do when I get "undefined" when I access the state using context in another component?
@ca-xo2ur
@ca-xo2ur 2 жыл бұрын
You're not importing it correctly?
@abbasahmadvand6866
@abbasahmadvand6866 Жыл бұрын
perfect bro
@farhanfadil4503
@farhanfadil4503 Жыл бұрын
Thanks a lot man :)
@manuelpineda924
@manuelpineda924 4 жыл бұрын
I was looking to do the same on redux but redux is a total pain to setup. Awesome video thank you, i'll use this method instead
@PedroTechnologies
@PedroTechnologies 4 жыл бұрын
Thank You For Watching! I agree, Redux is a hassle to setup.
@manuelpineda924
@manuelpineda924 4 жыл бұрын
@@PedroTechnologies definitely watching your other videos
@PedroTechnologies
@PedroTechnologies 4 жыл бұрын
Thank You!
@alexandrudorultan9001
@alexandrudorultan9001 Жыл бұрын
Hi, Provider doesn't working I tried to install that but still got in error any idea how to fix that?
@akaghzi
@akaghzi 2 жыл бұрын
Guru, how I deal with page reloads, because lossed the states when page reloads
@SatyamYadav-wh1zf
@SatyamYadav-wh1zf 11 ай бұрын
Pedro,I have doubt is that once I logged in and then refresh the page the whole logged in info gets vanished.
@nikolaswalter490
@nikolaswalter490 2 жыл бұрын
Trying this in react native and it does not work for some reason. Getting element type is invalid, you likely forgot to export your compoment or mixed up imports, even though I am pretty sure I got the imports down
@danehague1
@danehague1 2 жыл бұрын
Thank you, great tutorial
@FunkyFun493
@FunkyFun493 2 жыл бұрын
Thank you soo mutch
@shreyashkauthankar1928
@shreyashkauthankar1928 2 жыл бұрын
💯
@sonamohialdin3376
@sonamohialdin3376 2 жыл бұрын
So good tutorial very useful
@K-nz0
@K-nz0 2 жыл бұрын
Can it be possible to be able to change the state before the return braces, within a function? I need the boolean to be set to 'true' only within an if-else condition. I've tried to directly use "setLoggedIn=true;" but it says that I cant change const values.
@bars5762
@bars5762 2 жыл бұрын
wow that was clean explanation :)
@brianross1972
@brianross1972 3 жыл бұрын
Awsome!
@PedroTechnologies
@PedroTechnologies 3 жыл бұрын
Glad you think so!
@FunwithBlender
@FunwithBlender 2 жыл бұрын
Every example uses onclick.... wish there were examples on condition met trigger x without click
@viniththanasekaran1417
@viniththanasekaran1417 3 жыл бұрын
Thanks!
@wylakers1250
@wylakers1250 Жыл бұрын
love u
@semihozturk9665
@semihozturk9665 3 жыл бұрын
Thank you bro, it was helpful. Btw do you recommend me any site or tutorial or youtube videos for learning react, react-native in depth?
@lauracooper4676
@lauracooper4676 2 жыл бұрын
Is anyone getting the error: 'setLoggedIn is not a function'. I'd really appreciate some help
@nightcrawler6618
@nightcrawler6618 2 жыл бұрын
me, still haven't found the solution yet
@lauracooper4676
@lauracooper4676 2 жыл бұрын
@@nightcrawler6618 me neither sorry 😔
@lucasbpsx8566
@lucasbpsx8566 3 жыл бұрын
Cara como você fala tão bem inglês? Eu consigo ler textos complexos e escutar tudo, mas na hora de gravar um tutorial em inglês minha mente da tela azul
@PedroTechnologies
@PedroTechnologies 3 жыл бұрын
Boa mano! Eu tive o privilégio de aprender inglês ao mesmo tempo que eu aprendi português kkkkkk mas ainda tenho sotaque! Acho que é muito sobre prática
@dianamatvienko8068
@dianamatvienko8068 2 жыл бұрын
Thanks))
@ricardotech
@ricardotech 3 жыл бұрын
@manuelpineda924
@manuelpineda924 4 жыл бұрын
or is it better to use Redux?
@PedroTechnologies
@PedroTechnologies 4 жыл бұрын
To be honest, I used to use Redux (not for long though) but I stopped because I just don't see the benefit of using it outweighing all of the negative parts. I dislike the development experience with redux, and I prefer using the Context Api much more. I would say that using the Context API is a bit better, especially in regards to setting stuff up!
@manuelpineda924
@manuelpineda924 4 жыл бұрын
@@PedroTechnologies Yeah I can see that. I had to watch a 40min setup video compared to this 9 min one.
@leofreiitas
@leofreiitas 2 жыл бұрын
Does not work for me and I do not know why =/
@leofreiitas
@leofreiitas 2 жыл бұрын
I found out why it did not work hahaha, I have put {}, instead of [] when I was creating the hook on the parent =D
@Pareshbpatel
@Pareshbpatel 2 жыл бұрын
{2022-03-22}
@maxsalum6589
@maxsalum6589 Жыл бұрын
Honestly, I don't think it was a good example as you basically showed how to pass state to all children which is similar to props. useContext should be shown in contrast to props drilling, where you pass parent state to a, say, 'grand child' directly, i.e. not through passing props to child and then to its child. Otherwise, a good tut. Like your other videos mate. Gracias.
ReactJS Course [9] - UseContext Hook | State Management
21:10
PedroTech
Рет қаралды 48 М.
Context API in react | get the concept
29:00
Hitesh Choudhary
Рет қаралды 57 М.
From Small To Giant Pop Corn #katebrush #funny #shorts
00:17
Kate Brush
Рет қаралды 52 МЛН
escape in roblox in real life
00:13
Kan Andrey
Рет қаралды 77 МЛН
Global State with Context in React - React context
17:42
Weibenfalk
Рет қаралды 20 М.
Context API Tutorial For Beginners - Using React Hooks
12:26
PedroTech
Рет қаралды 204 М.
React useContext() hook introduction 🧗‍♂️
11:37
Bro Code
Рет қаралды 29 М.
Don't Use React Context!! Use This instead
13:34
CoderOne
Рет қаралды 28 М.
Learn React Hooks: useContext - Simply Explained!
15:46
Cosden Solutions
Рет қаралды 163 М.
useContext Crash Course - Manage State Globally with this React Hook
25:45
React Hooks Course - All React Hooks Explained
1:26:21
PedroTech
Рет қаралды 1,1 МЛН
Context API and useContext hook tutorial - ReactJs
25:17
Mafia Codes
Рет қаралды 24 М.