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

  Рет қаралды 85,047

PedroTech

PedroTech

Күн бұрын

Пікірлер: 95
@fallenZero12
@fallenZero12 2 жыл бұрын
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
@songokussj4cz
@songokussj4cz 2 жыл бұрын
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 2 жыл бұрын
Totally agree on this!!
@jaimemedina3351
@jaimemedina3351 2 жыл бұрын
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.
@lasindunuwanga5292
@lasindunuwanga5292 2 жыл бұрын
Your knowledge was always incredible. Now your video graphics and etc. are also evolving... Great effort
@PedroTechnologies
@PedroTechnologies 2 жыл бұрын
Appreciate it! Happy to see u are liking the videos :)
@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.
@tadakuniyasuda8214
@tadakuniyasuda8214 2 жыл бұрын
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.
@byronk5
@byronk5 Жыл бұрын
I really appreciate how balanced and informative this is . Great delivery and excellent content.
@ChitruShrestha
@ChitruShrestha 2 жыл бұрын
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.
@jaimemedina3351
@jaimemedina3351 2 жыл бұрын
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 2 жыл бұрын
Thank you Pedro for this one. It came at the right time for me.
@quelchx
@quelchx 2 жыл бұрын
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 2 жыл бұрын
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 2 жыл бұрын
@@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 =)
@yasensim
@yasensim 2 жыл бұрын
Thanks!
@PedroTechnologies
@PedroTechnologies 2 жыл бұрын
Thank you for the support!!!
@matt112fly
@matt112fly 2 жыл бұрын
perfect- i just wanted to look into the context API :) u helped me with redux so im looking forward to context api
@CodeWithClinton
@CodeWithClinton 5 ай бұрын
Awesome video Pedro, thank you so much for the knowledge shared.
@hassamulhaq7762
@hassamulhaq7762 2 жыл бұрын
Really informative content. I love your suggestions where and when.
@BoredBricks
@BoredBricks 2 жыл бұрын
Good timing, I needed this.
@elwoseopenstepcrew1134
@elwoseopenstepcrew1134 2 жыл бұрын
i have the same feeling about redux and graphQL xd amazing video, subscribed ! great job
@Aziz-kw6ct
@Aziz-kw6ct 8 ай бұрын
This video is a lifesaver, thanks a bunch!
@fabionunes2793
@fabionunes2793 2 жыл бұрын
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".
@berndeveloper
@berndeveloper Жыл бұрын
Love your video man, thanks so much for the info!
@saqibghouse
@saqibghouse 2 жыл бұрын
Can you also make a video on best practices on react app file structure. and styling please
@heitormbonfim
@heitormbonfim 2 жыл бұрын
Bruh, you're a life saver
@skl949
@skl949 2 жыл бұрын
you are the next web dev simplified i swear
@mdabidkalam3527
@mdabidkalam3527 Жыл бұрын
I loved the way you explained.
@GabrielMartinez-ez9ue
@GabrielMartinez-ez9ue 2 жыл бұрын
Great stuff as always. I pretty much use Zustand for everything these days.
@SahraClayton
@SahraClayton 2 жыл бұрын
Is Zustand any good
@GabrielMartinez-ez9ue
@GabrielMartinez-ez9ue 2 жыл бұрын
@@SahraClayton i like it a lot. It’s simple and no boilerplate as rtk
@austinbriencabanada8229
@austinbriencabanada8229 2 жыл бұрын
Thanks pedro .. really need this tutorial hope you make next.js typescript tutorial
@ytpeerz
@ytpeerz Жыл бұрын
Thanks for the video, helped me understand the context API
@misscarla_alhambra7345
@misscarla_alhambra7345 9 ай бұрын
THANKS! Was very informative and helpfull
@YabombomTelevision
@YabombomTelevision Жыл бұрын
Thats why i really like the vue team . They created pinia, and it has the solutions embeded in one solutions.
@aeiou...
@aeiou... Жыл бұрын
Yeah. Hope pinia isn't tied to vue though
@geicianecosta3925
@geicianecosta3925 2 жыл бұрын
Voce eh incrivel!!! Adoro seus videos :D
@nabinsaud4688
@nabinsaud4688 2 жыл бұрын
Hello bro please make complete FIREBASE REACT VIDEO INCLUDING ALL
@soumadip_banerjee
@soumadip_banerjee 2 жыл бұрын
Love the content!
@willyhorizont8672
@willyhorizont8672 2 жыл бұрын
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.
@hood_love_189
@hood_love_189 2 жыл бұрын
Thank you for teaching me this stuff...
@enriquesantosdeoliveira5798
@enriquesantosdeoliveira5798 2 жыл бұрын
Olá Pedro! Vc tem conteúdos com typescript?
@AminSani
@AminSani 2 жыл бұрын
Could you please talk about RxJs or reactive state managment?
@papa_ethan
@papa_ethan 8 ай бұрын
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.
@1989SeanSmith
@1989SeanSmith Жыл бұрын
Could you add the starting code also, so that we can follow along from the beginning?
@theintrovert894
@theintrovert894 Жыл бұрын
i am terribly confused why he call child compoenet if he can directly call grandchild
@chethananderson3446
@chethananderson3446 2 жыл бұрын
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.
@sriramr1981
@sriramr1981 Жыл бұрын
Very Helpful. Thanks
@AM-nm6ts
@AM-nm6ts 2 жыл бұрын
if I use several providers. where I should put them please. like this? thanks a lot
@PedroTechnologies
@PedroTechnologies 2 жыл бұрын
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 2 жыл бұрын
@@PedroTechnologies thank you so much :) god bless you 🙏🙏
@aeiou...
@aeiou... Жыл бұрын
Im just getting back to react. Why not use redux for this kind of problems?
@cryptomallu6271
@cryptomallu6271 Жыл бұрын
great video. thanks man
@alexdefaro
@alexdefaro 2 жыл бұрын
Great video 👊
@chigbojames2803
@chigbojames2803 2 жыл бұрын
Do you have any video on react native?
@VijenderSingh-wr6fm
@VijenderSingh-wr6fm 6 ай бұрын
great video and explanation
@autumndavis2638
@autumndavis2638 2 жыл бұрын
Hey Pedro! Thanks for the video. What VSCode theme are you using? I love it!
@mezbahuddinrafi9081
@mezbahuddinrafi9081 2 жыл бұрын
dracula
@AsifKhan-ee8ez
@AsifKhan-ee8ez 2 жыл бұрын
When to use redux toolkit and when to use context api?
@akaabdullah
@akaabdullah 2 жыл бұрын
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
@ravisankar9122
@ravisankar9122 Жыл бұрын
Excellent video.
@kabagambedaniel2468
@kabagambedaniel2468 2 жыл бұрын
let me watch this one, i always learn a lot on this platform
@kevinemugisha9035
@kevinemugisha9035 Жыл бұрын
This was helful!
@filipevalentegomes2383
@filipevalentegomes2383 2 жыл бұрын
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 2 жыл бұрын
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.
@francoischevalier9608
@francoischevalier9608 2 жыл бұрын
You rock ! Thank so much
@nro337
@nro337 2 жыл бұрын
Thanks for this!
@slahomar1497
@slahomar1497 2 жыл бұрын
Could you make Relay tutorial please
@albertoginelsalvador2172
@albertoginelsalvador2172 2 жыл бұрын
How do you install it?
@AhmedKhan-rt6oz
@AhmedKhan-rt6oz 2 жыл бұрын
very well explained
@oncoding4520
@oncoding4520 2 жыл бұрын
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 2 жыл бұрын
watched and finished almost the hole series
@AmitSharma-nr1wi
@AmitSharma-nr1wi 11 ай бұрын
You can send some money to him
@discoverthecode2286
@discoverthecode2286 2 жыл бұрын
Thanks bro it heled me a lot. thanks a lot bro my sweet bro
@mohammadmahdialvansaz8001
@mohammadmahdialvansaz8001 2 жыл бұрын
thanks. it helped alot
@friendshipwithjavascript
@friendshipwithjavascript 2 жыл бұрын
Great Content
@akaabdullah
@akaabdullah 2 жыл бұрын
We need tutorial on REDUX with react
@devwithbrian1534
@devwithbrian1534 8 ай бұрын
Thanks Pedro
@anaselhassani2545
@anaselhassani2545 2 жыл бұрын
ty bruu
@AM-nm6ts
@AM-nm6ts 2 жыл бұрын
thanks a lot 🙏🙏
@fraternidadeaustriaca2625
@fraternidadeaustriaca2625 Жыл бұрын
excelente video
@pemadechen9199
@pemadechen9199 Жыл бұрын
Thank you :)
@augischadiegils.5109
@augischadiegils.5109 2 жыл бұрын
❤️❤️❤️
@muhammedozalp
@muhammedozalp Жыл бұрын
Thanks bro
@krateskim4169
@krateskim4169 Жыл бұрын
nice video
@nomapos
@nomapos 2 жыл бұрын
React native !!!!!!!!!!!!!!!!!!
@bahibrahim101
@bahibrahim101 2 жыл бұрын
Thanks
@anjalichauhan6347
@anjalichauhan6347 2 жыл бұрын
what are children and why are they passed as props
@tarek_maza
@tarek_maza 2 жыл бұрын
Badly explained
@RohitKumar-ht4sr
@RohitKumar-ht4sr 2 жыл бұрын
Download SUBSGAIN App from play store
@grazielak.pauselius4225
@grazielak.pauselius4225 2 жыл бұрын
Thank you, Pedro! The way you explain makes everything super easy! Go Brazil 🟢🟡🔵
@ThColinPereira
@ThColinPereira 2 жыл бұрын
Amazing video
React Hooks Course - All React Hooks Explained
1:26:21
PedroTech
Рет қаралды 1,1 МЛН
Try this prank with your friends 😂 @karina-kola
00:18
Andrey Grechka
Рет қаралды 9 МЛН
To Brawl AND BEYOND!
00:51
Brawl Stars
Рет қаралды 17 МЛН
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН
Learn React Hooks: useContext - Simply Explained!
15:46
Cosden Solutions
Рет қаралды 199 М.
Making React Context FAST!
33:34
Jack Herrington
Рет қаралды 90 М.
All The JavaScript You Need To Know For React
28:00
PedroTech
Рет қаралды 679 М.
The Biggest Mistake Intermediate React Developers Make
18:32
Cosden Solutions
Рет қаралды 39 М.
Context API in react | get the concept
29:00
Hitesh Choudhary
Рет қаралды 73 М.
Mastering React Context: Do you NEED a state manager?
37:26
Jack Herrington
Рет қаралды 101 М.
All 17 React Best Practices (IMPORTANT!)
1:46:11
ByteGrad
Рет қаралды 222 М.
All 29 Next.js Mistakes Beginners Make
1:45:10
ByteGrad
Рет қаралды 160 М.
Лайфхак: Легально делать деньги
0:43
пранк: псих сбежал из дурдома
0:53
Анна Зинкина
Рет қаралды 1,7 МЛН
ТЕЛЕФОН МЕНЯЕТ ЦВЕТ😅 #upx
0:34
RanF
Рет қаралды 639 М.
Карина Кросс #shorts
0:16
Dolly and Friends Shorts Cartoons
Рет қаралды 361 М.