Learn useContext In 13 Minutes

  Рет қаралды 732,225

Web Dev Simplified

Web Dev Simplified

Күн бұрын

Пікірлер: 617
@dimitrioszygolanis
@dimitrioszygolanis 11 ай бұрын
In order to simplify it, I think you could create an object, like const values = { darkTheme, toggle } and pass both values inside the ThemeContext.Provider, in order to avoid creating 2 providers.
@Xi-tler
@Xi-tler 10 ай бұрын
Yeah you r right
@AB-dp7pw
@AB-dp7pw 4 ай бұрын
How to use them in the component? Const {darktheme,toggleTheme} =usecontext(themecontext)? Is this right?
@dimitrioszygolanis
@dimitrioszygolanis 4 ай бұрын
@@AB-dp7pw Yeah, that's a way to use it. Another way is via custom hook like: export function useTheme() { const context = useContext(ThemeContext); if (!context) throw new Error("useContext must be within a ThemeContext Proviider"); return context; }
@ponnusamyv4812
@ponnusamyv4812 2 ай бұрын
he is just showing an example of how to use multiple contexts
@teenytinyteetee
@teenytinyteetee Ай бұрын
I was thinking why were the disconnected like that even though they are related
@piyush6631
@piyush6631 3 жыл бұрын
Took me like 2 hours and 4 breaks to understand the refactor that you did in the separate file. I also didn't knew that useContext(ThemeProvider) was just like a consumer for function based components. Your tutorials are so amazing. What a neat way to write code, keep making good videos!
@ashleytennyson4717
@ashleytennyson4717 2 жыл бұрын
same here .. took me loads of time to get a grasp of this 8 min of 7zip video of something which is like a whole chapter
@je2587
@je2587 2 жыл бұрын
lol same
@ronyfluk8396
@ronyfluk8396 2 жыл бұрын
If it took you 2 hours to understand what he did then I guess maybe the explanation isn`t that amazing after all? 🤔
@piyush6631
@piyush6631 2 жыл бұрын
@@ronyfluk8396 By that logic, you can learn HTML, CSS, JS, React and Authentication in just 10 hours by watching one of the BootCamp videos on youtube. Practising and implementing stuff takes much longer than watching a video on it, no matter how good the content is.
@ReadyBasket
@ReadyBasket 2 жыл бұрын
@@ronyfluk8396 no. I thought that too but Web Dev Simplified is a great tutor. The problem is we are probably all programmers with different years of experience and understand the problem but React introduces a new way to tackle a problem that probably didn't really exist until you started using React. Most people think to switch themes, just have two css files and have some code to change the class of the body from light to dark..... and you can even use local storage to remember the users choice... However if you use React, that solution may introduce other problems therefore useContext has to be understood.
@lonniesmith8093
@lonniesmith8093 Жыл бұрын
As a react beginner I'm sure this is a great explanation for someone with a little more experience. As a beginner I found this example to much. Passing a variable down such as a name or number would have been a great start IMO. I hope this is constructive criticism. You channel is amazing!
@nanonkay5669
@nanonkay5669 4 жыл бұрын
I think you can pass in not only state but also functions in the value attribute of the provider like this: {children} ...and then just destructor the two depending on what you need in a particular component.
@ylmazcandelen3121
@ylmazcandelen3121 4 жыл бұрын
yeah, I was like that's really easy why we need another provider but he finds his way cleaner I assume.
@wizhaa
@wizhaa 3 жыл бұрын
which variable would you destructure? like usually for props it is const { state, function } = props. what would you use instead of props in our children components?
@nvr5073
@nvr5073 3 жыл бұрын
@@wizhaa useContext(name of your context)
@王甯-h2x
@王甯-h2x 3 жыл бұрын
@@wizhaa useContext(CanYouReadThat)
@6365bharath
@6365bharath 2 жыл бұрын
Yeah why would you wrap it around another provider. It messes the code
@femaledeer
@femaledeer 4 жыл бұрын
These 13 minute videos end up taking me 2 hours to go through
@akshbansal7715
@akshbansal7715 4 жыл бұрын
Same here
@tvguideondemand
@tvguideondemand 4 жыл бұрын
I watched Mosh's 2 hour tutorial video and it took me 4 days.
@cabejackson7518
@cabejackson7518 4 жыл бұрын
lol i thought I was alone in this! I definitely set my pomodoro to watch this then do some practice problems then 25min later I was like wow I'm only like 5min into the video
@cabejackson7518
@cabejackson7518 4 жыл бұрын
still learning a lot though, just slow n steady
@migueldomingos4570
@migueldomingos4570 4 жыл бұрын
@@tvguideondemand mosh videos are normmaly very detailed and so it makes sense you took so long ;-)
@timothylander3469
@timothylander3469 Жыл бұрын
After watching the entire video once, then duplicating the project during a second viewing, I was able to understand the concepts well enough to add additional context variables and new sibling components that can easily communicate amongst themselves. Your explanations, demos, and walk-throughs are so clear, concise, and to-the-point that with some study, the concepts really begin to sink in. Thank you!
@cordial
@cordial 11 ай бұрын
etest
@sagarmodifrontend-develope9429
@sagarmodifrontend-develope9429 2 жыл бұрын
before watching the use context video I will suggest first reading the blog or article on use context given below the description it will help you a lot after that start watching the video and you can understand it easily.
@zevspitz8925
@zevspitz8925 Жыл бұрын
A gentle introduction to useContext and context in general. Two points: As others have noted, I would have a single provider for both the darkTheme and toggleTheme values. Also, I found it confusing that the button now has to live within the FunctionComponent. I'm not sure which is better: wrap the App component in ThemeProvider one level up, or create an intermediate component to hold the button and the FunctionComponent.
@TheRealAfroRick
@TheRealAfroRick 2 жыл бұрын
I think the hardest part of this is that you are doing it with themes. If you were to simply expose an object or something and have it available in all of the children, it might be a little bit clearer. Using the theme is actually muddying up your demo.
@liondepierre
@liondepierre 2 жыл бұрын
Agree
@user-ti9yn8wg6o
@user-ti9yn8wg6o 2 жыл бұрын
Sorta agreed. Although theme here is just boolean value, but new comers need to wrap their head around this one more level
@jtaylor8606
@jtaylor8606 Жыл бұрын
Absolutely, I just can't get my head around this explanation, going to need to check another vid
@kainthjaskaran
@kainthjaskaran Жыл бұрын
@@jtaylor8606 Hey check this video out. It helped me a bit better than this kzbin.info/www/bejne/nobLiKePjcyaZqs
@dvirhanum9530
@dvirhanum9530 Жыл бұрын
but what about updating it's value? How would you re-render the app?
@bigmicki
@bigmicki 4 жыл бұрын
Good concise video. One important thing to point out for people wanting to throw redux out in favor of context is that dont think of react context as a replacement for redux, as it is a very expensive operation for react for high frequency updates with react context. For that use redux. for low frequency updates like selecting a locale for you app and something similar, react context is perfect for that use case. This is important as people tend to go crazy after learning react hooks and start refactoring entire code base to this hot new tech. Find the sweet spot.
@ba8e
@ba8e 2 жыл бұрын
The best wat to handle state is to dump this piece of shit framework and embrace the king called Svelte.
@thecuriouskid3606
@thecuriouskid3606 Жыл бұрын
@@ba8e Yuppppppp reactivity rules
@pesovatech6899
@pesovatech6899 2 жыл бұрын
Bro you did a refractor and scattered my head on understanding the first one, simplified refractor ended up hardening the whole thing 😭 I had to stop watching and go on with the first method, thanks for the Video
@LieberLois
@LieberLois 3 жыл бұрын
Great Video about Context! Im just disagreeing with creating multiple Contexts for a variable and its Setter function! You can just pass both as an object as the context value :)
@deonvisser2480
@deonvisser2480 2 жыл бұрын
I was also wondering why he didn't do this.
@talatkuyuk6556
@talatkuyuk6556 2 жыл бұрын
In your case, you are right. But think about you use styled-component's ThemeProvider which accepts only DefaultTheme, that is why nested provider is an option for this case.
@teenytinyteetee
@teenytinyteetee Ай бұрын
I wondered this too. Like why when they are so similar.
@AlldayIshid
@AlldayIshid 4 жыл бұрын
I love this guy so much but he's persona is what I imagine an alien would create if they were trying to build a human
@pim691
@pim691 3 жыл бұрын
I've really come to like his personality and his method of explanation.
@arthurswanson3285
@arthurswanson3285 3 жыл бұрын
Right. His cadence sounds like it was the outcome of a deep learning algo.
@scriptkeeper8243
@scriptkeeper8243 3 жыл бұрын
Be greatful youngling, Kyles stormed Area 51, found alien tech, then set loose their clones to teach us all how to upgrade our world and get better paying jobs.
@oliversaxon8656
@oliversaxon8656 3 жыл бұрын
Why would an alien build a human is my question
@dm.hol.3624
@dm.hol.3624 3 жыл бұрын
are you all gays here lol
@KevinVandyTech
@KevinVandyTech 4 жыл бұрын
After watching this video, I refactored one of my side projects, and it's so much cleaner.
@persuingrelaxation1346
@persuingrelaxation1346 2 ай бұрын
I'm glad your project got cleaner
@smdude4
@smdude4 2 жыл бұрын
I can't believe how easy it is to understand it the way you explained it. Using your vids as a refresher (haven't done react in a while) and it's been super helpful for my job search. Not sure you're gonna read this but THANK YOU. Will take your full course
@garywaddell6309
@garywaddell6309 3 жыл бұрын
Not too sure I understand some of the negative comments, this was a super explanation of useContext and a perfect approach to allow token based security for react apps. Thank you!
@brijspy
@brijspy 4 жыл бұрын
Thanks a lot kyle :) I have seen so many videos of useContext hook but never seen this kind of a structure which is awesome to maintain and scale. This is gold.
@bama2619
@bama2619 8 ай бұрын
5:46 simplification begins. The point of simplification is wrapping hooks inside components. Creating your own custom hooks is powerfull tool. Did not know those tricks. Thank you
@AndroidCyclist
@AndroidCyclist 5 ай бұрын
Thank you so much for making these videos. My job is moving to react native from native mobile development and I have found these to be very helpful and even shared the playlist with my team.
@dreamfly555
@dreamfly555 4 жыл бұрын
This assumes you know what a context is and how in general it's being used. i.e., not for beginners.
@hungryreaper23
@hungryreaper23 4 жыл бұрын
I agree, tbh this is not really a tutorial more like watching someone code while somewhat explaining his thought process.
@IncomingLegend
@IncomingLegend 4 жыл бұрын
literally 90% of all tutorials assume you are a beginner and I'm getting fucking tired of it... I find intermediate or advanced tutorials such as these very refreshing and sadly they are quite rare...
@migueldomingos4570
@migueldomingos4570 4 жыл бұрын
@@IncomingLegend Me too bro. Tech With Tim has done some nice intermediate and expert python playlist and also object oriented design were he doesnt treat you like a begginner. You may want to check him out
@number1neek
@number1neek 4 жыл бұрын
Trust me, come back to this when you need a quick refresher and you'll love how concise this is.
@heathenfire
@heathenfire 4 жыл бұрын
Great video. I just started learning about useReducer and useContext. So perfect timing!!
@mrdoner3451
@mrdoner3451 3 жыл бұрын
The most informative channel I have found for web dev. Thanks again for clearing up another complicated topic so concisely.
@mr_weirdo
@mr_weirdo Жыл бұрын
useContext from 1:14 using useContext in Function Component : 3:49 Custom Hook : 6:00
@msfkmsfk
@msfkmsfk 2 жыл бұрын
It's taking me a while but after rewatching your video several times, I finally think I'm starting to wrap my head around custom hooks and the useContext hook. I think what kinda fucked me up was that I was so used to and comfortable with useState, props, and basic components that that kinda made me a little cocky and ignorant to the full power of useContext and how to build custom hooks. All in all useState only has one statement that has a value and a setter function that is destructed and stated and initialized all in one statement. useContext on the other hand needs to be initialized and then passed on to all the applicable components using the Provider and it also needs a value that you pass along in the Provider as well. So with state its basically just the value and the setter function along with the useState hook. With useContext you have to initialize the context using creatContext. Then pass the context to all of its applicable child components using the provider and in the provider you need to pass along a value. And I think the reason why it took me so long to understand this is because with state you give it an initial value (even if its null) as soon as you initialize / create it but with context you have to wait and pass it its value in the provider. Now that's what really fucked me up for a while but now I think I'm finally starting to get it. Thank you Kyle for the great video and yes I'm a customer of your React course and while its not Udemy cheap I still really appreciate the low and affordable price of the course and all the lessons and your great teaching style.😀
@varundoshi5136
@varundoshi5136 Жыл бұрын
This channel literally has everything that I search for. Can't thank you enough for sharing your knowledge!
@ruggeddog3103
@ruggeddog3103 3 жыл бұрын
instead of creating two contexts for values i passed it like this ' value={{ darkTheme, toggleTheme }} ' and opened it like this ' { darkTheme, toggleTheme } = useTheme() ' and it's working
@TOMGAMING-hy9hi
@TOMGAMING-hy9hi 3 жыл бұрын
yupp that's good way to put both into one object instead of nesting context providers.......
@anshulmanapure1980
@anshulmanapure1980 2 жыл бұрын
To all those who say it was very easy to understand, I take a bow. Cuz I didn't understood a shit. He maybe cleared alot of concepts but my puny little mind could not comprehend them. Maybe need to rewatch, take breaks, code along, weigh every word and might get it. Have a good day you'll.
@isacoliveira6326
@isacoliveira6326 2 жыл бұрын
This is easily one of the most insightful videos about web dev I've ever seen. Not only because of the pattern it advances with useContext, but also for how well it illustrates the pursuit of encapsulation and ellegance. Kudos!
@codesymphony
@codesymphony Жыл бұрын
nothing elegant about it
@bulentgercek
@bulentgercek Жыл бұрын
Hatred is of no use to you or anyone else.
@SaurabhNative
@SaurabhNative 3 жыл бұрын
This was another useful video from your channel. The first example of useContext in functional/class based components was easy. Second example was a but advanced but still easy to figure out and understand. Thanks for making such awesome content.
@yumyum7196
@yumyum7196 Жыл бұрын
I love your videos and I usually get it on the spot, but honestly this is the first time that it went straight over my head
@jasonhuang4333
@jasonhuang4333 3 жыл бұрын
Great! I think you can also combine different values into 'value' props in Context as an object. e.g. value = {[ theme: contextTheme, updateTheme: contextUpdateTheme }}
@supremachine
@supremachine 3 жыл бұрын
Yeah, I wonder if we have to use separate contexts for them? Did combining them work for you?
@vendetta3953
@vendetta3953 2 жыл бұрын
you can provide an object which has multiple keys in it, I haven't checked with passing an array though.
@thecuriouskid3606
@thecuriouskid3606 Жыл бұрын
@@supremachine Yeah yeah it totally works. I was commenting that myself up there.
@thecuriouskid3606
@thecuriouskid3606 Жыл бұрын
@@vendetta3953 Oooooooh that's not an array I think it's a typo. The closing brace is a curly brace so I guess he was thinking about an object in mind.
@tino6986
@tino6986 3 жыл бұрын
Amazing, I have a class yesterday about useContext, but now, after your video, I'm closer to be able to handle it!!
@k3v1n_xlr84
@k3v1n_xlr84 3 жыл бұрын
You are one of the best at being able to articulate advanced concepts in an easy-to-digest format. Living up to your name. I don't know where I would be without your lessons, you're literally godlike.
@andremazetto
@andremazetto 2 жыл бұрын
Wowwwwwww! I can finally understand this. Very well explained and broken down. I like how you explain from many different angles so you really get your point across
@alex.noriega
@alex.noriega 2 жыл бұрын
Hey old friend! Your like a team mate who takes enough time to explain what we need for the sake of continue our work. I always go back to this channel if there's any concept or JS feature that I don't really understand right after read hundreds of articles or blog publications. Thanks in advance.
@DrMorganClydesdale
@DrMorganClydesdale 4 жыл бұрын
fantastic video! I am trying to combine this with your "useReducer" video right now for a somewhat complex bit of state management... I think a video like these combining the two concepts would be a smash hit my dude.
@hwj8640
@hwj8640 2 жыл бұрын
awesome video, after seeing some articles on internet, this video helps me understand useContext in in only 13 minutes. thanks!
@ytrtricks
@ytrtricks Ай бұрын
nice explanation than other youtubers
@braingamedotcom
@braingamedotcom 2 жыл бұрын
you sir, are a legend.
@padeiroPorAmor
@padeiroPorAmor 2 жыл бұрын
Awesome video, I like how he increase the code without loosing the complexity understanding of the context.
@umafly
@umafly 3 жыл бұрын
Not going to lie this is probably the first time I can't follow you without rewinding. The pace is very high in this one, nothing like the other hooks
@ArchimedesTrajano
@ArchimedesTrajano 3 жыл бұрын
I think one gotcha people need to know (at least I hit it) was the context is not available outside where you put the Provider. So if you put your Context provider in your `App.jsx` and you want to have some initial state, you need to make sure that the state can be built without data or services that are defined in the context. An example of it would be loading data from AsyncStorage that contains initial data and putting it in your "AppLoading" block. Took a bit of refactoring for me to address the issue. Not hard, just annoying thing to *realize* after the fact.
@rishisetpal3537
@rishisetpal3537 Жыл бұрын
Kyle Thanks for your Guidance U helped us to learn How to create Context: const AnyContext = React.createContext() How to Provide value from the Context to all Children: AnyContext.Provider value={anyState} In Advance Section of creating SeperateContextComponent where we have all Context Related stuff But, We only got to know how it works with Functional Component What about Class Components? AnyOne ? Also, how can we work with data updating like strings, lists and objects???
@justinr4650
@justinr4650 3 жыл бұрын
Kyle you are the man, I can already see you as the top developer trainer in the world!
@Davidgon100
@Davidgon100 2 жыл бұрын
Your reactjs videos are the best! You explain so well and your examples are excellent. I understood this right away after being confused by someone else's vid
@ozzyfromspace
@ozzyfromspace 3 жыл бұрын
Thank you! I was working on a little webapp and totally blanked on the pattern for creating the custom hooks (near the end of the video). You're awesome man 🎊☮️
@SBH618
@SBH618 4 жыл бұрын
I literally spent hours yesterday to get this to work, I have terrible timing
@kinstar
@kinstar 3 жыл бұрын
😂 atleast you know now
@RipedGames
@RipedGames 3 жыл бұрын
This is really clear and good guide to this. Though I went through a react course and have solid fundamentals so there is a bias
@eddiechen6389
@eddiechen6389 4 жыл бұрын
Yo your youtube title is telling the truth!!! hands down the best version so far !!! thank you!
@ivantorres6577
@ivantorres6577 4 жыл бұрын
These are amazing thanks for making these, I am in a bootcamp at the moment and we are learning react. These help clear things up a ton so thank you for making these. Keep up the good work Kyle
@someshwartripathi8446
@someshwartripathi8446 Жыл бұрын
How did life turnout after the bootcamp?
@Loys2020
@Loys2020 2 жыл бұрын
This is an awesome tutorial. I needed to watche 2 times but it's very clear how useContext works. Great, Kyle. Wish you all the best.
@rakeshpk4991
@rakeshpk4991 3 жыл бұрын
Well explained. This is the best explanation about useContext compared to all other videos in this subject. Thanks.
@mielu_gazos
@mielu_gazos 3 жыл бұрын
Use this example as the shortest version of Consumer in Class Component. import React from 'react'; import { IDataContext, DataContext } from './DataContextProvider'; class ClassContextConsumer2 extends React.Component { static contextType = DataContext; context!: React.ContextType; render() { return ( Consumer 2 {this.context.isConnected ? "Connected" : "Disconnected"} {this.context.myMessage} Press Websoket Press Text ); } }
@josevelez6865
@josevelez6865 3 жыл бұрын
Great video. Thanks. When you 'take it a step further' around 5:45, I had to re-watch a few times. LOL. My brain shut down the first time watching. I guess, I was still processing the first 5 minutes.
@MoiseMUHIRE-op9md
@MoiseMUHIRE-op9md Жыл бұрын
I like when kyle say my job is to simplify web dev for you so you can start build your dream project sooner❤❤❤
@ShinAkuma
@ShinAkuma 11 ай бұрын
This was hard to understand. So I made chatGpt write everything for me. Thank you kyle.
@maksimkremlev2836
@maksimkremlev2836 3 жыл бұрын
Thanks a lot, you are an exceptional teacher and your code looks so clean!
@briandesign
@briandesign 4 жыл бұрын
just started learning React, so this is good to see
@SACHIN-gd6zy
@SACHIN-gd6zy 4 жыл бұрын
React is not good
@GustavoMartinZalazarGonzalez
@GustavoMartinZalazarGonzalez 4 жыл бұрын
@@SACHIN-gd6zy So what's good?
@SACHIN-gd6zy
@SACHIN-gd6zy 4 жыл бұрын
@@GustavoMartinZalazarGonzalez Angular
@SACHIN-gd6zy
@SACHIN-gd6zy 4 жыл бұрын
@@GustavoMartinZalazarGonzalez u want to know the reason? i have plenty :)
@SACHIN-gd6zy
@SACHIN-gd6zy 4 жыл бұрын
@Tigran Khachaturian stfu
@militoarturo
@militoarturo 3 жыл бұрын
I had to rewatch to fully get it, but it all makes sense now. Thanks mate! As always cristal clear explanations, keep up the great work!!
@njayman
@njayman 4 жыл бұрын
I have been waiting for this one for so long. Thanks a lot
@meepinandmorpin
@meepinandmorpin 3 жыл бұрын
You're my hero at this point. I'm literally watching this while on the job.
@talatkuyuk6556
@talatkuyuk6556 4 жыл бұрын
I passed darkTheme and toggleTheme together as an object in ThemeProvider. export function ThemeProvider ({ children }) { const [darkTheme, setDarkTheme] = useState(true) function toggleTheme () { setDarkTheme(currentTheme => !currentTheme) } const value = { darkTheme, toggleTheme } return ( {children} ) } in the component I destructed them and used. const { darkTheme, toggleTheme } = useTheme() It worked.
@darkrist
@darkrist Жыл бұрын
this video is way too hard, ive been trying to understand this many times but still confuses me after min 6
@piusvictor8780
@piusvictor8780 3 жыл бұрын
This tutorial is highly recommended for anyone who needs to understand context API concepts, great Job KYLE ✨✨✨
@solomonrajkumar5537
@solomonrajkumar5537 3 жыл бұрын
there are no words to appreciate your explanation.. infinity hats off!!! God Bless!
@sourabhmunjal3830
@sourabhmunjal3830 Жыл бұрын
Very well explained, though I have to see this video 3 times to completely understand. Also then confusion about when to use redux and context.
@vehktaur
@vehktaur Жыл бұрын
I actually needed this tutorial on a project i was working on that also involved switching theme from light to dark mode and vice versa so this fit my need perfectly. the second half of the video was really confusing tho
@wasimnadaf11
@wasimnadaf11 Жыл бұрын
Ver clearly explained. The concept is really drilled into my mind. thank you for this amazing video
@dl_dt1467
@dl_dt1467 3 жыл бұрын
Thank you so much! I recommend everyone to code along and examine to understand easier
@christianalejandro4963
@christianalejandro4963 4 жыл бұрын
Amazing explanation. I've been able to refactor a complex, nested code using this pattern in minutes. Thank you !
@programmingpython584
@programmingpython584 2 жыл бұрын
These hooks videos were just awesome. really easy to understand. Thank you so much
@migueldomingos4570
@migueldomingos4570 4 жыл бұрын
Just asking, but when he makes two contexts couldn't he just put the function to update the theme and the real value in the same context with an object? Edit: I think I know the reason now: When the context changes the components that have useContext rerender. So if you putted both func and value in the same context when the value changed even if the componentwas only using the func it would rerender
@nagresubhas
@nagresubhas 4 жыл бұрын
was thinking the same thing
@whoman7930
@whoman7930 4 жыл бұрын
Same Pinch.
@jl7610
@jl7610 4 жыл бұрын
You can definitely do this. My senior developer, after questioning what the hell I was doing, recommened this approach: stackoverflow.com/questions/54738681/how-to-change-context-value-while-using-react-hook-of-usecontext/61224379#61224379
@3rdman99
@3rdman99 4 жыл бұрын
Absolutely. He could've easily passed an object (instead of values) to one context that contains both dardTheme and toggleTheme. I was confused about that too because I thought there was some technical reason for him to create multiple contexts. There is none. I think a lot of people got confused at that point of the video and lost track. He's usually pretty good with pointing out and clarifying obviously confusing points like that, but not this one.
@vaylx2253
@vaylx2253 2 жыл бұрын
@@3rdman99 Indeed. He usually does a great job and his Hooks series is absolutely phenomenal. This is the only video that kind of confused me of the lot :)
@PatrikRasch
@PatrikRasch Жыл бұрын
Good stuff, great to get a deeper understanding of stuff I learn from The Odin Project from you on here!
@mateusbarbosa5266
@mateusbarbosa5266 Жыл бұрын
I love Kyle's lessons, he's probably the one instructor on youtube that I don't get bored watching, but I can't be the one who watches his videos in 0.75 speed, dude be too quick with his logical structures as he speaks lol
@jawedpoya3453
@jawedpoya3453 11 ай бұрын
Hello, Genius bro I love your way of working with JS. From Afghanistan . Thank you so much.
@biglightgaming6847
@biglightgaming6847 3 ай бұрын
Notice when he says "make sure to subscribe to the channel...". when he says "subscribe", the Subscribe button lights up. Nice touch!
@abhishekghosh2316
@abhishekghosh2316 3 жыл бұрын
This is so perfect. Exactly what I was looking for. Thank you :)
@tushargoyal3088
@tushargoyal3088 2 жыл бұрын
what are your thoughts on passing on the update theme function as a value to the original theme context? (instead of it being its own context provider)
@987Stephen1
@987Stephen1 Жыл бұрын
Last night, I was lying in bed and said to myself "You know, my next step is to really understand 'UseContext'. I wonder if Kyle has a video about it?". Low and behold, here it is. I wouldn't say I fully understand Context, but it's a good start.
@peterlogo1149
@peterlogo1149 3 жыл бұрын
Thank you for the tutorial saved me a lot of time in my current project. God bless you.
@KemMuhammad
@KemMuhammad 3 жыл бұрын
Just what I needed this Saturday morning, made my app work perfectly! ~ Thank You!
@greenaddict123
@greenaddict123 3 жыл бұрын
I just had a problem where I didn't capitalize the 'p' under Provider. Took me a good 3 minutes to debug :)) Anyway, thanks you as always, Kyle! ^_^
@SolidousMdz
@SolidousMdz 3 жыл бұрын
I actually liked the end API with this, other than having the methods together in the context.
@thecuriouskid3606
@thecuriouskid3606 Жыл бұрын
Btw you could've used a single custom hook for everything here. You could have passed the context as an object like themeData = {darkTheme: darkTheme, toggleTheme: toggleTheme} and then use them in there like ThemeContext.darkTheme and ThemeContext.toggleTheme instead of wrapping the child with two providers. One provider but carrying the data with in an object and you can even call the function using that.
@mokroargra7277
@mokroargra7277 4 жыл бұрын
I highly suggest his react course. I was able to convert my vanilla JS app to react after his course. I took my time though I didn't do it all in one day.
@stevereid636
@stevereid636 3 жыл бұрын
This is Awesome! I’m totally going to make use this tomorrow. 👍🏾
@superdev4024
@superdev4024 9 ай бұрын
This video is incredibly simple and valuable. Thank you. Why don't you pass the theme update function as an object attribute instead of creating another theme context?
@sojumoscow
@sojumoscow 4 жыл бұрын
Woah, when I watched this I cant everything. I think this is not for totally beginner at React Context, I think it assumes you that you have a knowledge already in it, but I think this is a big help if you have a basic knowledge bout this
@S_Chandra503
@S_Chandra503 4 жыл бұрын
Simple and nice explanation of useContext. Thanks a lot Kyle for such a videos. Keep up good work!
@mrluckyuncle
@mrluckyuncle Жыл бұрын
You're great :-) Excellent, clear explanation, and I was able to put it to use right away.
@SammarpanDasguptaOfficial
@SammarpanDasguptaOfficial 3 жыл бұрын
Thanks for makes these things very easier for me. Love your content. keep it up.
@rickeyupadhyay6898
@rickeyupadhyay6898 2 жыл бұрын
Hi Kyle Another good video! I would request you to create a series or a crash course on react-redux and redux thunk as well!
@haidernaqvi87
@haidernaqvi87 3 жыл бұрын
useContext: I am gonna destroy this man(Redux)'s whole career.
@toohee8561
@toohee8561 Жыл бұрын
Look forward for your courses Kyle!
11 ай бұрын
I'm an Angular developer, and the context involves a lot of RXJS logic. However, RXJS is much easier than dealing with the context-way easier.
@dustatron
@dustatron 4 жыл бұрын
This was a great tutorial. This is something i will refer back to in the future
@MolinRJ
@MolinRJ 3 жыл бұрын
i am refering that to myself right now, for the third time in a week
@aes0p895
@aes0p895 Жыл бұрын
really helpful and perfect examples. helped me make my spaghetti app into something much less of a headache.
@danielEpifanov
@danielEpifanov 3 жыл бұрын
wow, this is exactly how the mui built their theming. Thank you for the explanation before that I was struggling to understand it.
@Hobbitstomper
@Hobbitstomper 4 жыл бұрын
Your room looks like my room. Then I was told that an empty and monotone room can be a sign of depression. But I think that's just the way most devs have their room... practical and not artistic :)
@Dustb0
@Dustb0 3 жыл бұрын
I feel seen
@rohandevaki4349
@rohandevaki4349 4 жыл бұрын
you made the code complex, but you refractored it in the right way.
Learn useReducer In 20 Minutes
20:12
Web Dev Simplified
Рет қаралды 516 М.
Learn React Hooks: useContext - Simply Explained!
15:46
Cosden Solutions
Рет қаралды 186 М.
The IMPOSSIBLE Puzzle..
00:55
Stokes Twins
Рет қаралды 176 МЛН
How Much Tape To Stop A Lamborghini?
00:15
MrBeast
Рет қаралды 224 МЛН
Farmer narrowly escapes tiger attack
00:20
CTV News
Рет қаралды 7 МЛН
The Gophers Are Destroying Our Tile System!!
22:00
Larson Farms
Рет қаралды 159 М.
Don't Use React Context!! Use This instead
13:34
CoderOne
Рет қаралды 29 М.
You might not need useEffect() ...
21:45
Academind
Рет қаралды 175 М.
How To Build Feature Flags Like A Senior Dev In 20 Minutes
20:33
Web Dev Simplified
Рет қаралды 96 М.
Learn useEffect In 13 Minutes
13:38
Web Dev Simplified
Рет қаралды 849 М.
Context API Tutorial For Beginners - Using React Hooks
12:26
PedroTech
Рет қаралды 211 М.
React useContext() hook introduction 🧗‍♂️
11:37
Bro Code
Рет қаралды 37 М.
Top 6 React Hook Mistakes Beginners Make
21:18
Web Dev Simplified
Рет қаралды 581 М.
Context API in react | get the concept
29:00
Hitesh Choudhary
Рет қаралды 67 М.