All you need to know about the Context API | React Context API Crash Course

  Рет қаралды 79,566

PedroTech

PedroTech

Күн бұрын

In this video I will go over the built in State Management solution for react. Context API is a very interesting api but it is constantly misused, so I wanted to go over my thoughts on it.
Code: github.com/machadop1407/conte...
Join our Discord: / discord
🚀 Learn ReactJS By Building 6 Projects: codedamn.com/learn/reactjs-pr...
🐙 GraphQL Course: codedamn.com/learn/graphql-fo...
► Buy Crypto on Coinbase: coinbase-consumer.sjv.io/PedroTech
Social
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Website: machadopedro.com
Linkedin: / machadop1407
Instagram: / _pedro.machado_
Github: github.com/machadop1407
Business Email: pedro@pedrotech.co
Timestamps:
00:00 | Intro
01:11 | Why use the ContextAPI?
05:48 | Creating a context
07:00 | Creating a context provider
10:32 | Best Practices - Creating context provider components
13:25 | Drawback of ContextAPI
Tags:
- ReactJS Tutorial
- ReactJS and MySQL
- NodeJS Tutorial
- API Tutorial
#reactjs #contextapi

Пікірлер: 94
@tadakuniyasuda8214
@tadakuniyasuda8214 Жыл бұрын
Informational, straight to point, friendly, and motivational. I really like how you give us your honest opinion near the end based on your experience. It helps us learners because we are overwhelmed by so many things to learn from. Now I am going to watch your hooks video. Thank you again.
@mostafa2199
@mostafa2199 Жыл бұрын
Great video. I like how you didn't just explain how to implement context, but also revealed the drawbacks and mentioned where to use it.
@byronk5
@byronk5 Жыл бұрын
I really appreciate how balanced and informative this is . Great delivery and excellent content.
@ramosjeromedelrosario6103
@ramosjeromedelrosario6103 Жыл бұрын
im really struggling to stop avoid unnecessary rerenders when using context api, you gave me the idea on how should i fixed it, thanks man
@ChitruShrestha
@ChitruShrestha Жыл бұрын
Thank you for taking the time to give drawbacks and opinions and your preferred method. It really made it easy to wrap around broad concepts.
@lasindunuwanga5292
@lasindunuwanga5292 Жыл бұрын
Your knowledge was always incredible. Now your video graphics and etc. are also evolving... Great effort
@PedroTechnologies
@PedroTechnologies Жыл бұрын
Appreciate it! Happy to see u are liking the videos :)
@jaimemedina3351
@jaimemedina3351 Жыл бұрын
Good stuff here. I appreciate how the downside of context management is underscored. One really needs to think about state, but also the way the state changes.
@frankiefab
@frankiefab Жыл бұрын
Thank you Pedro for this one. It came at the right time for me.
@hassamulhaq7762
@hassamulhaq7762 Жыл бұрын
Really informative content. I love your suggestions where and when.
@matt112fly
@matt112fly Жыл бұрын
perfect- i just wanted to look into the context API :) u helped me with redux so im looking forward to context api
@berndeveloper
@berndeveloper Жыл бұрын
Love your video man, thanks so much for the info!
@BoredBricks
@BoredBricks Жыл бұрын
Good timing, I needed this.
@Aziz-kw6ct
@Aziz-kw6ct Ай бұрын
This video is a lifesaver, thanks a bunch!
@ytpeerz
@ytpeerz Жыл бұрын
Thanks for the video, helped me understand the context API
@elwoseopenstepcrew1134
@elwoseopenstepcrew1134 Жыл бұрын
i have the same feeling about redux and graphQL xd amazing video, subscribed ! great job
@misscarla_alhambra7345
@misscarla_alhambra7345 2 ай бұрын
THANKS! Was very informative and helpfull
@sriramr1981
@sriramr1981 8 ай бұрын
Very Helpful. Thanks
@mdabidkalam3527
@mdabidkalam3527 10 ай бұрын
I loved the way you explained.
@nikolozmacharashvili1212
@nikolozmacharashvili1212 Жыл бұрын
Thank you for teaching me this stuff...
@geicianecosta3925
@geicianecosta3925 Жыл бұрын
Voce eh incrivel!!! Adoro seus videos :D
@austinbriencabanada8229
@austinbriencabanada8229 Жыл бұрын
Thanks pedro .. really need this tutorial hope you make next.js typescript tutorial
@songokussj4cz
@songokussj4cz Жыл бұрын
Hi Pedro. Really nice, as always. I really liked your video on "4 types of Fetch" because you divided that into different files like it would be in production. Here at 8:20 you're saying "And obviously I'm doing it in one file. But imagine how it would look if you separate that to more files". Please: these people (myself partly included) which are watchich these beginner videos have almost certainly a problem to see how it would work with imports and so on in those separate files. So my tip for next time, show it in one file, no problem, but then, for 5 seconds (at the end for example) show it separated to more files with good file names and file structure. Nearly all internet tutorials, for "simplicity" are showing everything in one file.... Be different! Be closer to production! Like you were in "4 types of Fetch video" :-)
@sravyanandina
@sravyanandina Жыл бұрын
Totally agree on this!!
@jaimemedina3351
@jaimemedina3351 Жыл бұрын
Nonsense. The one file approach did a great job in showing the prop drilling tendency in React. Make your own videos before handing out 'tips'.
@chippandenga6722
@chippandenga6722 Жыл бұрын
@@jaimemedina3351 😂Nothing wrong with suggestions. I am sure the creator appreciates the suggestion.
@heitormbonfim
@heitormbonfim Жыл бұрын
Bruh, you're a life saver
@soumadip_skyy_banerjee
@soumadip_skyy_banerjee Жыл бұрын
Love the content!
@nro337
@nro337 Жыл бұрын
Thanks for this!
@cryptomallu6271
@cryptomallu6271 Жыл бұрын
great video. thanks man
@mohammadmahdialvansaz8001
@mohammadmahdialvansaz8001 Жыл бұрын
thanks. it helped alot
@kevinemugisha9035
@kevinemugisha9035 7 ай бұрын
This was helful!
@francoischevalier9608
@francoischevalier9608 Жыл бұрын
You rock ! Thank so much
@AhmedKhan-rt6oz
@AhmedKhan-rt6oz Жыл бұрын
very well explained
@ravisankar9122
@ravisankar9122 4 ай бұрын
Excellent video.
@pemadechen9199
@pemadechen9199 Жыл бұрын
Thank you :)
@devwithbrian1534
@devwithbrian1534 21 күн бұрын
Thanks Pedro
@alexdefaro
@alexdefaro Жыл бұрын
Great video 👊
@GabrielMartinez-ez9ue
@GabrielMartinez-ez9ue Жыл бұрын
Great stuff as always. I pretty much use Zustand for everything these days.
@SahraClayton
@SahraClayton Жыл бұрын
Is Zustand any good
@GabrielMartinez-ez9ue
@GabrielMartinez-ez9ue Жыл бұрын
@@SahraClayton i like it a lot. It’s simple and no boilerplate as rtk
@saqibghouse
@saqibghouse Жыл бұрын
Can you also make a video on best practices on react app file structure. and styling please
@autumndavis2638
@autumndavis2638 Жыл бұрын
Hey Pedro! Thanks for the video. What VSCode theme are you using? I love it!
@mezbahuddinrafi9081
@mezbahuddinrafi9081 Жыл бұрын
dracula
@AM-nm6ts
@AM-nm6ts Жыл бұрын
thanks a lot 🙏🙏
@anaselhassani2545
@anaselhassani2545 Жыл бұрын
ty bruu
@muhammedozalp
@muhammedozalp 9 ай бұрын
Thanks bro
@yasensim
@yasensim Жыл бұрын
Thanks!
@PedroTechnologies
@PedroTechnologies Жыл бұрын
Thank you for the support!!!
@friendshipwithjavascript
@friendshipwithjavascript Жыл бұрын
Great Content
@fraternidadeaustriaca2625
@fraternidadeaustriaca2625 Жыл бұрын
excelente video
@quelchx
@quelchx Жыл бұрын
If you try to pass a null value into a createContext while you are using Typescript it will throw a warning. Yeah, you can change your tsconfig to ignore this (ignore null checks). There is a workaround, can't remember it at the moment -- but I figure I share this for the TS guys who might be watching this video while working LOL.
@PedroTechnologies
@PedroTechnologies Жыл бұрын
Yes! I use typescript at my job and on side projects, what I do is I create an object called `defaultValues` and also specify the format of the context with an interface
@quelchx
@quelchx Жыл бұрын
@@PedroTechnologies Sounds about right. I have worked on some code bases were I think we did something like that with an initial state or like this (been a while) const authContext = useContext({} as AuthContextType) the context type being an ts interface or however we did it I forgets and am too lazy to go back and look =)
@bahibrahim101
@bahibrahim101 Жыл бұрын
Thanks
@ThColinPereira
@ThColinPereira Жыл бұрын
Amazing video
@discoverthecode2286
@discoverthecode2286 Жыл бұрын
Thanks bro it heled me a lot. thanks a lot bro my sweet bro
@willyhorizont8672
@willyhorizont8672 Жыл бұрын
yo pedro, I create ContextProvider for socket io and use it for layout in react-router-dom element and use Outlet as a children inside that ContextProvider is that okay? previously I use builtin useOutletContext hooks provided by r-r-d but I have nested protected route so its throw and error.
@kabagambedaniel2468
@kabagambedaniel2468 Жыл бұрын
let me watch this one, i always learn a lot on this platform
@fabionunes2793
@fabionunes2793 Жыл бұрын
A quick question: the re rendering is really a drawback the re rendering is a misunderstood feature of context? I mean, the name itself says, context. Is a thing to wrap components inside to warn these components, like: "hey, the state you want to show changed, so let's re render".
@enriquesantosdeoliveira5798
@enriquesantosdeoliveira5798 Жыл бұрын
Olá Pedro! Vc tem conteúdos com typescript?
@AminSani
@AminSani Жыл бұрын
Could you please talk about RxJs or reactive state managment?
@nabinsaud4688
@nabinsaud4688 Жыл бұрын
Hello bro please make complete FIREBASE REACT VIDEO INCLUDING ALL
@YabombomTelevision
@YabombomTelevision Жыл бұрын
Thats why i really like the vue team . They created pinia, and it has the solutions embeded in one solutions.
@aeiou...
@aeiou... 11 ай бұрын
Yeah. Hope pinia isn't tied to vue though
@krateskim4169
@krateskim4169 Жыл бұрын
nice video
@chigbojames2803
@chigbojames2803 Жыл бұрын
Do you have any video on react native?
@AsifKhan-ee8ez
@AsifKhan-ee8ez Жыл бұрын
When to use redux toolkit and when to use context api?
@papa_ethan
@papa_ethan Ай бұрын
You know you are just explaining to yourself, and do not mind that the viewer does not have the ideas of what you are saying so you should show what you are saying. Remember the point is you are here in order to be understood.
@aeiou...
@aeiou... 11 ай бұрын
Im just getting back to react. Why not use redux for this kind of problems?
@skl949
@skl949 Жыл бұрын
you are the next web dev simplified i swear
@AM-nm6ts
@AM-nm6ts Жыл бұрын
if I use several providers. where I should put them please. like this? thanks a lot
@PedroTechnologies
@PedroTechnologies Жыл бұрын
You can put them where ever you want! You could do it like this if you want to access all the data from each provider everywhere in the app. But you can also put providers inside of the app so that the data is only accessible inside of a group of components
@AM-nm6ts
@AM-nm6ts Жыл бұрын
@@PedroTechnologies thank you so much :) god bless you 🙏🙏
@jordantanaliga100
@jordantanaliga100 Жыл бұрын
Could you do typescript in react ?
@slahomar1497
@slahomar1497 Жыл бұрын
Could you make Relay tutorial please
@chethananderson3446
@chethananderson3446 Жыл бұрын
the changes made to this context object does'nt re-render the child components , you're passing the setUsername as a reference to the value prop, the reason why it is re-rendering is , you're making changes to the state by passing its setUsername reference and offcourse if a state in parent component changes the child component is re-rendered. Context API changes doesnt re-render it's child components.
@akaabdullah
@akaabdullah Жыл бұрын
well i understand what you tried to tell so now please make a tutorial on REDUX
@Savics_dev
@Savics_dev Жыл бұрын
He already has a tutorial on redux... well detailed
@1989SeanSmith
@1989SeanSmith 11 ай бұрын
Could you add the starting code also, so that we can follow along from the beginning?
@theintrovert894
@theintrovert894 11 ай бұрын
i am terribly confused why he call child compoenet if he can directly call grandchild
@albertoginelsalvador2172
@albertoginelsalvador2172 Жыл бұрын
How do you install it?
@akaabdullah
@akaabdullah Жыл бұрын
We need tutorial on REDUX with react
@oncoding4520
@oncoding4520 Жыл бұрын
So I planned to watch the video on the series of your react tutorials but this on is more longer so im going to start with these. I wanted to give you a gift but dont know how to contact you
@oncoding4520
@oncoding4520 Жыл бұрын
watched and finished almost the hole series
@AmitSharma-nr1wi
@AmitSharma-nr1wi 3 ай бұрын
You can send some money to him
@augischadiegils.5109
@augischadiegils.5109 Жыл бұрын
❤️❤️❤️
@filipevalentegomes2383
@filipevalentegomes2383 Жыл бұрын
Wrapping multiple components with context will turn into a big mess the bigger the app gets. It’s good to know, but I would never use it, there are just too many better options.
@PedroTechnologies
@PedroTechnologies Жыл бұрын
I agree! Thats why i try to use React query + composition in most cases. And use the context api for general states that are rarely mutated.
@nomapos
@nomapos Жыл бұрын
React native !!!!!!!!!!!!!!!!!!
@anjalichauhan6347
@anjalichauhan6347 Жыл бұрын
what are children and why are they passed as props
@tarek_maza
@tarek_maza Жыл бұрын
Badly explained
@RohitKumar-ht4sr
@RohitKumar-ht4sr Жыл бұрын
Download SUBSGAIN App from play store
@grazielak.pauselius4225
@grazielak.pauselius4225 Жыл бұрын
Thank you, Pedro! The way you explain makes everything super easy! Go Brazil 🟢🟡🔵
Context API in react | get the concept
29:00
Hitesh Choudhary
Рет қаралды 39 М.
Learn useContext In 13 Minutes
13:08
Web Dev Simplified
Рет қаралды 692 М.
Hot Ball ASMR #asmr #asmrsounds #satisfying #relaxing #satisfyingvideo
00:19
Oddly Satisfying
Рет қаралды 17 МЛН
🍟Best French Fries Homemade #cooking #shorts
00:42
BANKII
Рет қаралды 42 МЛН
Why I avoid useEffect For API Calls and use React Query instead
17:45
Mastering React Context: Do you NEED a state manager?
37:26
Jack Herrington
Рет қаралды 96 М.
Mastering React Context 2023: The Complete Guide!
24:37
Josh tried coding
Рет қаралды 13 М.
Don't Use React Context!! Use This instead
13:34
CoderOne
Рет қаралды 25 М.
The correct way to optimise React
11:29
Cosden Solutions
Рет қаралды 29 М.
Why Signals Are Better Than React Hooks
16:30
Web Dev Simplified
Рет қаралды 450 М.
🚀 useContext, Context Provider, etc. - All about Context API in React
36:31
Studytonight with Abhishek
Рет қаралды 2,3 М.
Making React Context FAST!
33:34
Jack Herrington
Рет қаралды 85 М.
Цифровые песочные часы с AliExpress
0:45
cool watercooled mobile phone radiator #tech #cooler #ytfeed
0:14
Stark Edition
Рет қаралды 7 МЛН
ПРОБЛЕМА МЕХАНИЧЕСКИХ КЛАВИАТУР!🤬
0:59
Корнеич
Рет қаралды 3,6 МЛН