React Hooks Crash Course (useMemo, useCallback and more).

  Рет қаралды 78,846

developedbyed

developedbyed

10 ай бұрын

Check out my courses to become a PRO 🔥
developedbyed.com
Starting with useState, we explore how to leverage this hook to manage state within functional components. Discover how useState simplifies state management by providing a concise syntax and powerful capabilities, enabling you to create dynamic and interactive user interfaces.
Moving on, we dive into useEffect and useLayoutEffect, two essential hooks for handling side effects in React. Understand the crucial differences between these hooks and gain insights into when to use each one effectively. Learn how to incorporate asynchronous actions, data fetching, and other side effects seamlessly into your components.
Next, we explore useMemo, a powerful optimization hook that allows you to memoize expensive calculations and prevent unnecessary re-renders. Unlock the potential to enhance the performance of your applications by intelligently caching computed values and minimizing redundant computations.
We then shift our focus to useTransition, a relatively new addition to the React hooks family. Explore how useTransition empowers you to create smooth and seamless user experiences by adding asynchronous transitions and suspense to your application flow. Unleash the power of concurrent rendering and watch your UI come to life.
Continuing our journey, we unravel the benefits of useCallback, a hook that optimizes function references, preventing unnecessary re-renders. Discover how to optimize performance by memoizing callback functions, ensuring they remain consistent across renders while avoiding unnecessary recreations.
🎁Support me on Patreon for exclusive episodes, discord and more!
/ dev_ed
🛴 Follow me on:
Twitch: / developedbyed
Twitter: / developedbyed
Instagram: / developedbyed
Github: github.com/developedbyed/
#programming

Пікірлер: 96
@YLLIEEGD
@YLLIEEGD 9 ай бұрын
Timestamps 0:43 useState 4:26 useEffect 12:46 useContext 15:48 useReducer 20:09 useRef 21:35 useMemo 23:16 useCallback & useMemo 28:02 useTransition
@nuke7
@nuke7 3 ай бұрын
23:34 Love Svelte, tired of this react shite...
@duwainevandriel9816
@duwainevandriel9816 10 ай бұрын
Something you can discuss in one of your next videos is what the difference is between useContext and a 3rd party provider is like Redux, Zustand or Tanstack is to handle global state. There is a difference 🥳
@infoplus202
@infoplus202 5 ай бұрын
The only difference is that context is a react build in state management, and others are a separate Library
@unagai1111
@unagai1111 10 ай бұрын
I've been following you since 2019 when you were just getting started Just getting back into dev and glad to see that you are closing in to 1M Subscribers. Keep up the great work, you make learning fun!
@gayashanmadhuranga3375
@gayashanmadhuranga3375 9 ай бұрын
agree
@mr__atiur
@mr__atiur 9 ай бұрын
I've gone through many tutorials but this one cleared my mind with all the unused material and filled it with required data only. Thanks for this precious tutorial my gorgeous friend.🎉❤
@kocikoro
@kocikoro 7 ай бұрын
Great video as always! Thank you Ed!
@lukasGarciaSGS2
@lukasGarciaSGS2 10 ай бұрын
Thanks for helping the community. God bless you! Greetings from Brazil
@hamadamek
@hamadamek 10 ай бұрын
Amazing content. One request. Explain where you would use each hook in the real world. Your demo for reducer and context were so simple and clear, but I did not understand why these hooks were added to React in the first place
@MasterOfMisc
@MasterOfMisc 9 ай бұрын
Thanks for this video and for walking through all these. I especially like the idea of using Zustand. Will you ever make a video tutorial on this state management library?
@pedrobarbeitos
@pedrobarbeitos 9 ай бұрын
this was great thank you !
@rohanyadav2597
@rohanyadav2597 10 ай бұрын
You made a video, when i needed it the most thanks😅
@developedbyed
@developedbyed 10 ай бұрын
Where do Pirates get their hooks from?
@thisbevibhor
@thisbevibhor 10 ай бұрын
Do you want to "setCourse" to that place? @developedbyed
@anshulanand02
@anshulanand02 10 ай бұрын
Facebook
@zeeebooo86
@zeeebooo86 10 ай бұрын
Thank you man!! Appreciate it!
@ciphergirl9038
@ciphergirl9038 10 ай бұрын
Awesome content as always. This beign a React hooks crash course, the project name 'my-vue-app' got my eyes hooked! 😂
@AlexSmith-ms9xb
@AlexSmith-ms9xb 10 ай бұрын
Thanks for such amazing content. Please, please, please make a Zustand crash course!
@novanoskillz4151
@novanoskillz4151 8 ай бұрын
your useMemo example was the first time ive seen someone make sense of usememo. even my senior dev has had a hard time explaining it. all he ever says is use useMemo to memoize your function hahaha wtf!!! thanks for this video.
@chiragsharma4102
@chiragsharma4102 10 ай бұрын
Added to "pre interview revision" playlist
@kanodekoubillybrown3025
@kanodekoubillybrown3025 10 ай бұрын
I'm finally able to wrap my head around hooks ,I've mostly been using useEffect and useState, I just realized i've not been using the right approach.
@ashutosh_tiwari
@ashutosh_tiwari 6 ай бұрын
hey Ed thanks for this amazing video, can you please use all of these hooks in a project and show us a glimpse of why it is used and where to use the specific hook. Except (useState, useRef, useEffect, useEffectLayout)
@cggs3001
@cggs3001 10 ай бұрын
Svelte series!
@yajirushik2871
@yajirushik2871 7 ай бұрын
About the useTransition I din't knew it works like that, what I used every time for real time filtering with fetch was a fetch api with abort signal, this makes things easier 👌
@jensadria
@jensadria 10 ай бұрын
"At what point do we just stop and switch over to Svelte" - Truer words have never been spoken. At this point the entire dev world is just suffering from React Stockholm Syndrome
@abhishektomar7306
@abhishektomar7306 10 ай бұрын
Thanks Ed !!!
@benixmaximus
@benixmaximus 10 ай бұрын
Hello. Do you ever run specials on your full stack course? I love the stack that you have chosen by the way.
@HoNow222
@HoNow222 10 ай бұрын
"I'm tired of all this React shite" Us too brother, us too. ahah
@muhamadbadriyusuf5686
@muhamadbadriyusuf5686 10 ай бұрын
Hi ed..i need nextauth tutourial from you .. thanks ed
@RichardWalterLanda
@RichardWalterLanda 2 ай бұрын
thanks mate
@daromacs
@daromacs 9 ай бұрын
hey Ed some arduino or ESP32 projects with react interaction would be amazing!
@abuzubaer3083
@abuzubaer3083 10 ай бұрын
thank you
@PoprostuTaki
@PoprostuTaki 10 ай бұрын
Can you make a video about useSyncExternalStore? For example with data synchronization from localStorage?
@bakhtiyor_sulaymonov
@bakhtiyor_sulaymonov 7 ай бұрын
You made me think about svelte )
@sreeharshad1760
@sreeharshad1760 7 ай бұрын
hi when ever i use hooks in my own custom library i getting the error saying cannot read the null with the hook i used
@iedi3
@iedi3 8 ай бұрын
It’s funny the last part, Svelte. I’m learning React, due to popularity, while already using Vue. But I would’ve wanted to try Svelte… but there’s only an amount of time you can spend learning new things, while also having commercial skills, I’m also learning node/express, again, I wish I would’ve learned Nest…😂
@hiberniankingy
@hiberniankingy 9 ай бұрын
A thumbs up for questioning why we haven't moved over to Svelte lol
@kanodekoubillybrown3025
@kanodekoubillybrown3025 10 ай бұрын
Could you make a short video no how to make jquery work in nextjs13 app directory
@wajdwael8775
@wajdwael8775 5 ай бұрын
We need videos about React & TypeScript...
@tseringlama2146
@tseringlama2146 10 ай бұрын
hello brother please make a video on (express js) backend and (next js ) frontend about "server side " filtering data and pagination not using server action
@adhdGameDev
@adhdGameDev 10 ай бұрын
H we j❤😊
@tjbechard7059
@tjbechard7059 10 ай бұрын
🔥 🔥 🔥
@yathink2406
@yathink2406 10 ай бұрын
Can you make video on most underrated hook “useImperativeHandle” which is most useful
@meharsain728
@meharsain728 7 ай бұрын
@developedbyed Can you make a video on React Error Handling? like there's error boundry which react provide idk why these component are class component and theirs also react-error-boundry npm which actually provide you with hooks..... please NATURE DO SO ACTION MAKE ed SEE MY COMMENT & MAKE VIDEO ON IT
@Lazllb
@Lazllb 10 ай бұрын
Just recently jumped into React, coming from mostly a C/C++ background. It’s funny that l was literally looking these up yesterday. Thank you for these videos. I think my biggest confusion is with useCallback specifically and the dependency array. When using useCallback with an empty array, variables from useState are automatically updated but when using for example the result of a TanStack query inside the callback, they won’t update without specifying the dependency. Is this because in order to use an empty array, the variables should be referentially equal to each other? What sucks about React from a newbie perspective is thinking you know how all these hooks work and then realizing they do something internally completely differently than what you expected.
@user-uc2ct5dl4c
@user-uc2ct5dl4c 10 ай бұрын
We need 3d website tutorials 😁
@sunbertyv3947
@sunbertyv3947 9 ай бұрын
I have this problem, i downloaded node, and installed react with all packages, but then when i do localhost3000 i don't see my page, what can i do
@user-fj6sj7pu2x
@user-fj6sj7pu2x 4 ай бұрын
good
@bayandamabuza6587
@bayandamabuza6587 10 ай бұрын
What's the diff of setCount(count+1) and setCount(prev => prev + 1) When updating the count Which to use?
@thisbevibhor
@thisbevibhor 10 ай бұрын
setCount(count+1) would run with the current value of "count" which could be stale and you don't want to use it, setCount(prev => prev + 1) updates using the previous state where prev represents the previous value. This approach ensures that you're working with the most up-to-date state value because React guarantees to provide the latest state snapshot to the functional update.
@skyhappy
@skyhappy 10 ай бұрын
Use the later one, it makes your life easier, it works like await where it updates the state immediately and not async
@JaiRaj26
@JaiRaj26 10 ай бұрын
@thisbevibhor is right. Also Read about 'React Batching'.
@GamingZone11
@GamingZone11 10 ай бұрын
Hey bro create a video on how Javascript behind the scene work and also console.log behind the scenes work. Try to add more interviews stuff in your video so we developer knows everything thing
@GamingZone11
@GamingZone11 10 ай бұрын
I will be waiting for your next videos😊
@aryankalra5640
@aryankalra5640 7 ай бұрын
When you are trying to understand useMemo and useCallback by yourself 30:25
@Seven77tw
@Seven77tw 8 ай бұрын
i love you
@Raphael-bq1fc
@Raphael-bq1fc 9 ай бұрын
can someone explain at 9:24 again? why does it skip the count by 2?
@bartek_szajna
@bartek_szajna 5 ай бұрын
little late but: probably the component wrapping the whole app, it renders it twice for debugging purposes
@user-js1ym3xs9q
@user-js1ym3xs9q 7 ай бұрын
import React, { useEffect, useState } from 'react' const Test = () => { const [count, setCount] = useState(0); useEffect(() => { const vv = setInterval(() => { setCount(prev => prev + 1) }, 1000) }, []); return ( { setCount(prev => prev + 1) }}>{count} ) } export default Test i have no problem`` why?
@rowsncols
@rowsncols 10 ай бұрын
Does anyone know what color theme he's using?
@amyjaks
@amyjaks 9 ай бұрын
jellyfish
@stefansweb
@stefansweb 10 ай бұрын
Can we get a link to Github with these examples?
@suvigyabasnotra7378
@suvigyabasnotra7378 10 ай бұрын
30:45 Is that his vape on the table??
@duwainevandriel9816
@duwainevandriel9816 10 ай бұрын
when to use useMemo and when to use useReducer
@AhmedZahid-fq3ky
@AhmedZahid-fq3ky 10 ай бұрын
wow
@DavidWTube
@DavidWTube 10 ай бұрын
Content with value. Something The Primeagen will never grasp the concept of.
@DeMayzr
@DeMayzr 10 ай бұрын
You should add chapters to this video
@Nab_001
@Nab_001 9 ай бұрын
I already know how they work I just want to relearn them your way
@mohamedGado3
@mohamedGado3 10 ай бұрын
what's the extension name?
@sajidhssi3445
@sajidhssi3445 9 ай бұрын
React Developer Tools
@SatyamSingh-nr9tm
@SatyamSingh-nr9tm 10 ай бұрын
@thuanphamminh9733
@thuanphamminh9733 9 ай бұрын
how to re-render without setState on function => never can do that
@VikramSharma-cd4oy
@VikramSharma-cd4oy 10 ай бұрын
I just reached this topic today 😂 while revision 😂😂
@dharmikjain5288
@dharmikjain5288 10 ай бұрын
From where you are learning react
@jamesmanjada9553
@jamesmanjada9553 10 ай бұрын
👍
@VikramSharma-cd4oy
@VikramSharma-cd4oy 10 ай бұрын
@@dharmikjain5288 well my learning methods are weird but currently revising from w3
@VikramSharma-cd4oy
@VikramSharma-cd4oy 10 ай бұрын
W3school just revising to create some project
@b1mind
@b1mind 10 ай бұрын
useSvelte()
@joshuamodiba853
@joshuamodiba853 8 ай бұрын
🤦oh man i liked the components by what's up with these hooks limitations and easy to make bugs
@Mr-Yuki
@Mr-Yuki 10 ай бұрын
Bro i started learning react 2 days ago or so.... Stop READING MY MIND!
@carlosdavid4800
@carlosdavid4800 10 ай бұрын
First 😁
@rajeshp9319
@rajeshp9319 10 ай бұрын
I was first comment
@juanmacias5922
@juanmacias5922 10 ай бұрын
Crying in SolidJS ;_;
@solomonforjesusfoundation830
@solomonforjesusfoundation830 10 ай бұрын
I want to develop a world standard social media app with over 25 different features, please can you help me or introduce me to a professional company ??
@nope00372
@nope00372 4 ай бұрын
perso
@nuke7
@nuke7 3 ай бұрын
23:34 Love Svelte, tired of this react shite...
@Briefklammer1
@Briefklammer1 10 ай бұрын
React is a mess
@fadynader8778
@fadynader8778 10 ай бұрын
hey man just out of curiosity.. are you gay ? 😅😅
@sajidhssi3445
@sajidhssi3445 9 ай бұрын
he made a video a few months/a year ago with his girlfriend...
@dragx26
@dragx26 10 ай бұрын
If I get it 👈 I'll subscribe 😐🙂
@GoeHybrid
@GoeHybrid 9 ай бұрын
I hate hooks. They make code so hard to reason about + easily create bugs.
@paulclarke4099
@paulclarke4099 10 ай бұрын
I second the useSvelte() comment, its time to move away from all this ridiculous complexity 💯😃👍
@mawrez0098
@mawrez0098 9 ай бұрын
Learn React Hooks: useCallback - Simply Explained!
17:15
Cosden Solutions
Рет қаралды 65 М.
Dapatkan APA PUN YANG ANDA INGINKAN dengan GADGET ini #shorts
00:11
Gigazoom Indonesian
Рет қаралды 13 МЛН
顔面水槽がブサイク過ぎるwwwww
00:58
はじめしゃちょー(hajime)
Рет қаралды 71 МЛН
8 React Js performance optimization techniques YOU HAVE TO KNOW!
11:23
Landing Page in 10 Minutes with Astro and CodeStitch
9:45
Cedar Studios Web Design
Рет қаралды 7 М.
ALL React Hooks Explained in 12 Minutes
12:21
Code Bootcamp
Рет қаралды 34 М.
You Need React Query Now More Than Ever
11:04
Theo - t3․gg
Рет қаралды 135 М.
10 React Antipatterns to Avoid - Code This, Not That!
8:55
Fireship
Рет қаралды 704 М.
Mastering React Memo
26:56
Jack Herrington
Рет қаралды 130 М.
Why Signals Are Better Than React Hooks
16:30
Web Dev Simplified
Рет қаралды 442 М.
Vortex Cannon vs Drone
20:44
Mark Rober
Рет қаралды 13 МЛН
Which Phone Unlock Code Will You Choose? 🤔️
0:14
Game9bit
Рет қаралды 5 МЛН
Что еще за обходная зарядка?
0:30
Не шарю!
Рет қаралды 1,9 МЛН
M4 iPad Pro Impressions: Well This is Awkward
12:51
Marques Brownlee
Рет қаралды 5 МЛН
Why spend $10.000 on a flashlight when these are $200🗿
0:12
NIGHTOPERATOR
Рет қаралды 17 МЛН