Mastering React Context 2023: The Complete Guide!

  Рет қаралды 13,667

Josh tried coding

Josh tried coding

Күн бұрын

React Context is a critical concept to master once your projects get to a certain size. Context can drastically improve your code readability, help you avoid prop-drilling (passing props down through lots of components), and increase code maintainability.
0:00 Why learn React Context?
0:20 Overview: When and how to use context
5:56 Example project: Properly implementing context
⭐ My GitHub: github.com/joschan21
⭐ Our startup: wordful.ai

Пікірлер: 32
@Douwab
@Douwab Жыл бұрын
Really cool video! I use context a lot of times in my apps. If I could add a little something: I usually like to add a hook that goes with my Context Provider. An example here would be to export a useTheme method that returns useContext(ThemeProvider). It is not game changing but it adds a little bit of simplicity in the consumer code. 😊
@joshtriedcoding
@joshtriedcoding Жыл бұрын
Cheers man, with increasing complexity that sounds very reasonable
@lionroot_tv
@lionroot_tv Жыл бұрын
Great stuff, thanks Josh!
@joshtriedcoding
@joshtriedcoding Жыл бұрын
Cheers mate
@belkocik
@belkocik Жыл бұрын
Good explanation! :)
@codewithguillaume
@codewithguillaume Жыл бұрын
I was wrong about Context. Thanks Josh !
@codewithguillaume
@codewithguillaume Жыл бұрын
Love your new video setup btw ! :)
@joshtriedcoding
@joshtriedcoding Жыл бұрын
@@codewithguillaume Thanks man! In what sense were you wrong?
@techworld3043
@techworld3043 Жыл бұрын
great explanation.
@joshtriedcoding
@joshtriedcoding Жыл бұрын
Cheers
@MultiReylords
@MultiReylords Жыл бұрын
Hey Josh, It’s been a blessing to discover your youtube channel, I have learned so much from your recent videos. You mentioned that you do/did freelance, do you have any tips for how to get into that sort of work as a beginner? (I am based in Germany if that helps)
@joshtriedcoding
@joshtriedcoding Жыл бұрын
Cheers man. I'm based in Germany too, I think if you have no connections in the field or work to take on, making free stuff for yourself and your portfolio would be the first step. Get good at whatever you're coding and don't get lost in tutorial hell. After coding some projects, reach out to see if someone is willing to let you work for free (ideally someone well-known or with a good reputation). After all, you are providing real value to them for free. Then I'd take the next step to reach out to clients with that work experience under your belt and really give them value in your proposal. Analyze their website - what can be improved? Page speed? Design? Automating certain functionalities? Let them know (ideally, in a personal video you record for them, or just via email if you don't like that approach). Make sure to sound very respectful in that email, if you're working with smaller companies chances are someone they know personally did that website and you don't want to offend them. That was my approach :) Hope that text wasn't too long haha
@MultiReylords
@MultiReylords Жыл бұрын
@@joshtriedcoding Thank you for taking the time to write out such a detailed reply! This actually helps a ton and confirms that I am on the right path. 👍
@DiogoLScarmagnani
@DiogoLScarmagnani Ай бұрын
@@joshtriedcoding it was a very good text, I loved those tips. Thank you.
@angladephil
@angladephil Жыл бұрын
Context is ultimately a complicated (sophisticated ?) way to use global variables or objects ... Thanks for the good teaching.
@airixxxx
@airixxxx 11 ай бұрын
Global variables don't alter state.
@oncoding4520
@oncoding4520 Жыл бұрын
nice video, very informative and at the same time very helpful :)) What app do you use also to draw?
@ismaeltinta6118
@ismaeltinta6118 7 ай бұрын
excalidraw
@0xPanda1
@0xPanda1 Жыл бұрын
keep it up
@joshtriedcoding
@joshtriedcoding Жыл бұрын
Cheers appreciate it
@0xPanda1
@0xPanda1 Жыл бұрын
niiiice
@rafaelmelo7665
@rafaelmelo7665 3 ай бұрын
👏👏👏👏👏👏👏👏👏👏👏
@samoniumuziejus
@samoniumuziejus 9 ай бұрын
I used context-selector-api because useContext had rerendering problems
@sewerynwozniak3417
@sewerynwozniak3417 10 ай бұрын
Why setThemeValue in ThemeContext is empty and you add logic inside PageContent? Is it typical approach?
@blazi_0
@blazi_0 Жыл бұрын
Hi man a quick question that i really need to know, are providers exposed to a child that didn't export it? Let's say i passed password context to the root component Will user will be able to see password from the footer using some kind of trick from the browser? Though i didn't import the password from footer
@faiquejatu8649
@faiquejatu8649 11 ай бұрын
What is the root component for next 13 applications?
@emigrek
@emigrek Жыл бұрын
Why doing this classic way since we have things like Redux, Recoil, etc...? Whats the pros?
@joshtriedcoding
@joshtriedcoding Жыл бұрын
The first one is that you don't have to set aside days (at least for me it was days) to learn redux. Second, in most well-thought-out architectures you are fine with context and don't even need "heavier" state management solutions
@sewerynwozniak3417
@sewerynwozniak3417 10 ай бұрын
Good example of how typescript can make things much more complicated Really it was introduced to make coding easier and for me it's most time-consuming part of coding in react
@zombizombi
@zombizombi 8 ай бұрын
I'm only half way through the video butwhat do you mean its making things more difficult? He's only added type information which means more type inference and better completion... how is that a bad thing?
@crispasmakanani6617
@crispasmakanani6617 Жыл бұрын
hi can we talk inbox 😊
@2gbeh
@2gbeh 8 ай бұрын
In "2023"??? It's literally the same thing as it has always been years prior.
Making React Context FAST!
33:34
Jack Herrington
Рет қаралды 85 М.
Context API in react | get the concept
29:00
Hitesh Choudhary
Рет қаралды 41 М.
DELETE TOXICITY = 5 LEGENDARY STARR DROPS!
02:20
Brawl Stars
Рет қаралды 17 МЛН
IS THIS REAL FOOD OR NOT?🤔 PIKACHU AND SONIC CONFUSE THE CAT! 😺🍫
00:41
MEU IRMÃO FICOU FAMOSO
00:52
Matheus Kriwat
Рет қаралды 9 МЛН
World’s Deadliest Obstacle Course!
28:25
MrBeast
Рет қаралды 65 МЛН
Mastering React Context: Do you NEED a state manager?
37:26
Jack Herrington
Рет қаралды 96 М.
🚀 useContext, Context Provider, etc. - All about Context API in React
36:31
Studytonight with Abhishek
Рет қаралды 2,4 М.
Learn NextJS's Superpower ISR in 15 Minutes
15:35
Josh tried coding
Рет қаралды 35 М.
Why Signals Are Better Than React Hooks
16:30
Web Dev Simplified
Рет қаралды 453 М.
TypeScript Generics are EASY once you know this
22:21
ByteGrad
Рет қаралды 123 М.
Don't Use React Context!! Use This instead
13:34
CoderOne
Рет қаралды 26 М.
React Context API with TypeScript | UserContext React TypeScript
14:47
WebDevWithArtisan
Рет қаралды 13 М.
Купил этот ваш VR.
37:21
Ремонтяш
Рет қаралды 240 М.
Will the battery emit smoke if it rotates rapidly?
0:11
Meaningful Cartoons 183
Рет қаралды 17 МЛН
🔥Идеальный чехол для iPhone! 📱 #apple #iphone
0:36
Bardak ile Projektör Nasıl Yapılır?
0:19
Safak Novruz
Рет қаралды 6 МЛН
How To Unlock Your iphone With Your Voice
0:34
요루퐁 yorupong
Рет қаралды 23 МЛН
ВЫ ЧЕ СДЕЛАЛИ С iOS 18?
22:40
Overtake lab
Рет қаралды 120 М.