Learn useMemo In 10 Minutes

Поділитися
Вставка
  • Опубліковано 4 січ 2025

КОМЕНТАРІ • 414

  • @franco-cespi
    @franco-cespi 4 роки тому +328

    These advanced Ract functions are really tricky to understand. You always come with concise videos that explains them really well. Thank you!

  • @tajpouria
    @tajpouria 4 роки тому +229

    Best useMemo introduction video I seen so far, Please cover more hooks

  • @elhaambasheerch7058
    @elhaambasheerch7058 Рік тому +35

    The amount of clarity Kyle gives while explaining complex concepts is truly unmatched, certainly my go to channel to learn tough concepts.

  • @tienlx91
    @tienlx91 3 роки тому +131

    2 common use cases of useMemo:
    1. When you want to make a slow function wrap inside useMemo so that doesn't re-compute every single time you render your component and it only computed when you acually need the value from that function since the inputs actually change
    2. Whenever you want to make sure the reference of an object or an array is exactly the same as it was the last time you rendered if none of the internal workings changed, you're gonna want to useMemo here to make sure that you only update the reference of that object whenever the actual contents of the object change instead of updating every single time you render

    • @kirankamath5891
      @kirankamath5891 Рік тому

      It is exactly same as Pure components in class

    • @ayeshasarwar615
      @ayeshasarwar615 Рік тому +5

      @@kirankamath5891 isnt point can be achieved through useEffect() too?

    • @DERICKBLACIDOCONTRERAS-c7f
      @DERICKBLACIDOCONTRERAS-c7f Рік тому

      I found 3 cases:
      1. Memoizing props to prevent wasted renders
      2. Memoizing values to avoid expensive re-calculation on every render
      3. Memoizing values that are used in dependency array of another hook

    • @itsgojoverfr
      @itsgojoverfr Рік тому +2

      @@ayeshasarwar615 i had the same question but sadly you can't, the variable would be defined INSIDE the useEffect hook and we won't be able to access it outside of it due to scoping

  • @daminipurohit6916
    @daminipurohit6916 4 роки тому +8

    First thing I do to learn a new tech is see if you have a video on it already so I can learn it fast and easily! Thank you very much for helping developers like me out there. Best wishes!! :)

  • @girri
    @girri 4 роки тому +10

    This is the clearest explanation I have seen on this topic! Great work!

  • @yitzchaksviridyuk932
    @yitzchaksviridyuk932 4 роки тому +17

    To be honest, after looking around youtube for some time, I was quite dissatisfied with the tutorials covering react hooks. I clicked on this video ready for another let down, but your video was great!! You cover topics clearly and concisely with a great balance between verbally explaining and showing your code. (I hope that made sense.) Gonna probably go through your whole hooks playlist now. Thanks a lot for the great video.

  • @sahidulislamjony5769
    @sahidulislamjony5769 2 роки тому +2

    Memoization of object is huge learning for me. Thank you Kyel

  • @aryanshmahato
    @aryanshmahato 4 роки тому +28

    It's really helpful.. please explain useCallback and other hooks please

  • @bencodes
    @bencodes 3 роки тому +10

    Your explanation is so concise and well thought out. Thank you!

  • @nareshbhati7527
    @nareshbhati7527 3 роки тому +7

    In every video, you will be taught new things, unlike other UA-camrs. Thank you so much for providing such amazing concepts for free.

  • @haniamania5884
    @haniamania5884 2 роки тому

    Dziękujemy.

  • @dean6046
    @dean6046 4 роки тому +33

    Thank you Kyle! My girlfriend refers to you as the robot guy. You are some kind of Terminator robot sent here from the future to help us with all of our programming needs.

    • @hugobqd
      @hugobqd 4 роки тому +6

      You can notice that he blink at 5:21

    • @dec2mclaren
      @dec2mclaren 4 роки тому +1

      my wife agrees :'D

    • @devolee8302
      @devolee8302 4 роки тому +1

      lol

  • @ionutsandu5913
    @ionutsandu5913 3 роки тому +2

    This guy is pure gold when it comes for web development tutorials. Luckily he matches my stack. Can't thank him enough. Keep doing this man :)

  • @Sandhyausa
    @Sandhyausa 2 роки тому

    Truly commendable. As far as the videos i have seen, none of the youTuber explained this. Thank you so much for explaining meticulously. God bless you.

  • @ashwinsuryawanshi
    @ashwinsuryawanshi 3 роки тому

    Being simple is not so simple and Kyle has mastered it.

  • @xWildStorm7x
    @xWildStorm7x 4 роки тому +1

    Thanks for the video! Best useMemo tutorial I've seen. And that second use you explained at the end for useEffect with objects and arrays in the dependencies is awesome. I didn't know how to handle those cases.

  • @jovantancevski7629
    @jovantancevski7629 2 роки тому

    Best UseMemo video I've seen so far, good job Kyle !

  • @-anonim-3008
    @-anonim-3008 11 місяців тому

    Ohh, thank so much! I watched you video 3 month ago and didn't understand second case, but now you open my eyes! Thanks a lot!

  • @suryaprakashm1886
    @suryaprakashm1886 2 роки тому

    Sucha an amazin explanation dude !!! Was trying to wrap my head around the memo hook ... your explanation was spot on .

  • @RejetiMeghaVardhan
    @RejetiMeghaVardhan Місяць тому

    Thank you Kyle! for giving such clarity in explanation

  • @jaytran247
    @jaytran247 4 роки тому +1

    Thanks very much for a great explanation.
    Recap: 9:49

  • @Kim-by5uy
    @Kim-by5uy 2 роки тому

    Finally, a concise explanation of useMemo

  • @wittyhumour29
    @wittyhumour29 3 роки тому +4

    Fantastic tutorial Kyle. Your explanation is precise, on point, and understandable. Your series about React-Hooks is one of the best on UA-cam.

  • @nazarpasha
    @nazarpasha 2 роки тому +1

    easy explanation thanks bro👍

  • @sangdilbiswal30
    @sangdilbiswal30 2 місяці тому

    bro your explanations are insane

  • @roadsideromeo9215
    @roadsideromeo9215 2 роки тому

    You killed it man, that's awesome. You make my concept clear. Thanks buddy.

  • @romko-romario
    @romko-romario 3 роки тому

    Just a brilliant explanation, lots of thanks! My mentor told me to learn memoization, and after just 10 minutes of this video, I understood what it's for and how to use it.

  • @陽楊-o3l
    @陽楊-o3l 4 роки тому

    The most simplest video but easiest understand about hooks ,Thank you so much for you sir~

  • @jessejburton
    @jessejburton 4 роки тому

    Super helpful! One of the best descriptions of useMemo I have seen. Thanks :)

  • @ThomasPGeorgeCSB-
    @ThomasPGeorgeCSB- 10 місяців тому

    This was the best example to understand useMemo. Thanks a lot!

  • @tomino133
    @tomino133 4 роки тому

    Dude I stumbled upon your channel again and it is a gold mine. Thank you!

  • @lpaddikt
    @lpaddikt 3 роки тому +1

    Amazing video, always can count on your videos being succinct and informative. Thanks man.

  • @julietonyekaoha402
    @julietonyekaoha402 2 роки тому

    The sample code explains why and when useMemo is needed very well. Thank you Kyle.

    • @Briefklammer1
      @Briefklammer1 2 роки тому

      So why dont we use useEffect for the first example?

  • @JuanDGoPro
    @JuanDGoPro 3 роки тому

    Finally!, I understand this useMemo function, thanks

  • @anuragk6722
    @anuragk6722 2 роки тому

    By far the best explanation

  • @sologuitardeshchatterjee
    @sologuitardeshchatterjee 4 роки тому

    Best useMemo explanation so far... Was longing for it... Thaks Kyle! :)

  • @ViktorHugo-je6rq
    @ViktorHugo-je6rq Рік тому

    Thanks Kyle for explanation.
    Separate thanks for your clear english.
    It's easy to hear and to understand each word you say.

  • @yatrikamrutiya9376
    @yatrikamrutiya9376 2 роки тому

    Amazing man!! loved your explanation!!

  • @morphman86
    @morphman86 3 роки тому

    Excellent tutorial, as always. Completely unrelated, but that audio artefact around 7:44 almost had me throw my headphones away again.
    That exact sound is what my headphones usually make when they break.
    Because I got distracted, I decided to rewind a few seconds to hear what you said, and the artefact was there at the exact same spot. That's when I realized it was the video and not my headphones -_-
    Yeah, I go through a lot of headphones, about 8-10 pairs per year. Always the left one going first, for some reason...

  • @yassineaker
    @yassineaker 2 роки тому

    You are absolutely a legend. Your examples are very concise and clear.

  • @karim6179
    @karim6179 Рік тому

    i literally been searching in udemy for a course that explain react hooks like this saw couple of videos but none of theme get to that great content quality feels guilty to get that for free thanks man

  • @ogat8909
    @ogat8909 3 роки тому

    Nice to have Kyle in the world of internet, you're my ideal dev!

  • @devDive615
    @devDive615 Рік тому

    oooh that was the best explanation i've seen so far

  • @parrot785
    @parrot785 3 роки тому

    I like your videos very much, because they are short and you manage to explain things in a simple way. Thank you!

  • @cervece41
    @cervece41 4 роки тому +2

    Awesome stuff as usual Kyle, I'd love to see an useCallback tut, thanks!

  • @ekwan16
    @ekwan16 3 роки тому

    Extremely clear explanation!

  • @MolinRJ
    @MolinRJ 4 роки тому

    that second application example was really mindBlowing. Thanks.

  • @hayveno
    @hayveno 2 роки тому

    Well explained, Kudos Kyle.

  • @shadmanmartinpiyal4057
    @shadmanmartinpiyal4057 3 роки тому +1

    just decided to increment my knowledge of react with this react hooks playlilst during the weekend. Rock on!

  • @MarcoS-bx5uk
    @MarcoS-bx5uk 4 роки тому

    Great. Examples are simple and explanation goes straight to the point.

  • @gourabpaul3560
    @gourabpaul3560 3 роки тому

    I love you man, this is so easy to understand.

  • @RohithVarma36
    @RohithVarma36 3 роки тому

    Best Practical cases are covered, awesome.

  • @dsuryas
    @dsuryas 3 роки тому +2

    I just immediately fell in love with useMemo. I mean, wow!

  • @DrWillway
    @DrWillway 2 роки тому

    I am in love with this guy! thank you for explanations :)

  • @LEGnewTube
    @LEGnewTube Рік тому

    Clear as crystal. Thank you for the vid!

  • @briancasady6182
    @briancasady6182 2 роки тому

    This was exactly what i was looking for, thanks!

  • @yinonelbaz5309
    @yinonelbaz5309 2 роки тому +1

    Amazing explanation!! Thank you so much for the channel and the hard work you put into it, I really appreciate it!!!

  • @freak2137
    @freak2137 3 роки тому

    cant wait to implement this trick on my project! Great tutorial!

  • @АлексейСтепанов-к9о

    Thanks for the great explanation. Now for my the useMemo march clear than before.

  • @nitinkadam8588
    @nitinkadam8588 6 місяців тому

    Key Differences
    - useMemo is used to memoize values.
    - useCallback is used to memoize functions.
    Usage:
    - Use useMemo when you have a computation that you want to avoid recalculating unless necessary.
    - Expensive calculations that don’t need to be recalculated every render.
    - Derived state that involves costly processing.
    - Large lists or data sets that require processing before rendering.
    - Passing objects or arrays as props to prevent unnecessary re-renders of child components.
    - Complex dependency arrays in hooks.
    - Use useCallback when you have a function that you want to avoid recreating unless necessary.
    Return Value:
    - useMemo returns the result of the computation.
    - useCallback returns the memoized function.

  • @kaylemaclou
    @kaylemaclou 2 роки тому

    Well explained, Kyle!

  • @anthonysim563
    @anthonysim563 2 роки тому

    This was an excellent explanation! Thank you!

  • @serhiikhrapin5024
    @serhiikhrapin5024 3 роки тому +2

    5:49 In fact, useMemo is not called on every single render of the component. It only gets called when number changes.

    • @koningguidokip
      @koningguidokip 2 роки тому

      I think useMemo get’s called every single time, but useMemo detects if the input has changed and decides if the callback function needs to be executed

  • @nikhil6842
    @nikhil6842 2 роки тому

    Great Tutorial Kyle

  • @ZehnGen
    @ZehnGen 3 роки тому

    Thanks a lot for this simple explanation with an example, helped me understand some use cases a lot more.

  • @davidgentilli7944
    @davidgentilli7944 4 роки тому

    Simple and clear explanation! Thank you

  • @talkwithshiva8941
    @talkwithshiva8941 3 роки тому

    you explained with so much ease best video

  • @udaychandra7663
    @udaychandra7663 3 роки тому

    Thank you for your clean explanation and it helps me a lot!

  • @dimitargetsov9690
    @dimitargetsov9690 4 роки тому

    Sir Kyle, Friends, useMemo(()=>()=>()=>()=>someresult) works!
    If i am not wrong , useMemo executes not only the function passed to it ,but continues and executes
    the nested in function, nested in function, nested in function...function.

  • @taufikdev
    @taufikdev 4 роки тому

    Thank you Kyle ! 10 minutes which makes me understand :)

  • @SOUVIK_RAY_
    @SOUVIK_RAY_ 3 роки тому

    Amazing explanation! Great video!

  • @fbiindia9661
    @fbiindia9661 2 роки тому

    you are a legend Sir! going through a Meta certified frontend course and they did a pretty bad job at explaining memo, I already knew where I have to come to understand it better and I was correct.

  • @AB-dp7pw
    @AB-dp7pw 10 місяців тому

    Great video kyle!

  • @mhdfirassbarakat6587
    @mhdfirassbarakat6587 2 роки тому

    keep in mind that my entire career depends on your videos 😂😂😂😂 so keep up the great work 💙💙

  • @aravindmnair_
    @aravindmnair_ 4 роки тому

    Man, you deserve more subs! big thumbs up

  • @naveenkumar-vb8tp
    @naveenkumar-vb8tp 3 роки тому

    Amazing explanation🙌, have never seen like this before. thank you

  • @billwu7367
    @billwu7367 Рік тому

    you are a skillful and smart ,patient youngster

  • @shakdaniel
    @shakdaniel 4 роки тому

    Very good explanation! great video man, keep it up! 🦾

  • @viktoriiapetrova5801
    @viktoriiapetrova5801 10 місяців тому

    Bravo! Great explanation!

  • @tambolaking5383
    @tambolaking5383 4 роки тому +1

    This content is awesome. Need more such performance improving ideas

  • @phantom7132
    @phantom7132 4 роки тому

    The object-example was a good one!

  • @jakexz4251
    @jakexz4251 2 роки тому

    bro you are a god, you just save me thank you so much

  • @lukeh8392
    @lukeh8392 3 роки тому

    Your videos are spot on thanks dude

  • @mostinho7
    @mostinho7 2 роки тому

    Todo:
    2:50 why does react seem to detect change in double number variable even though it’s not state? It doesn’t, but when the state changes the react component is re-rendered which means all the code inside our functional component runs again, so slow function is executed

  • @gabrielaugustodevitodabbad6822
    @gabrielaugustodevitodabbad6822 3 роки тому

    Amazing explanation, thanks

  • @tinnguyenvan9925
    @tinnguyenvan9925 4 роки тому +1

    Thank you . This video help me understandings about useMemo

  • @TechnoDB
    @TechnoDB 4 роки тому +2

    Simple and Clean Background..
    Nice ))

  • @alvarocastillocorrea2610
    @alvarocastillocorrea2610 4 роки тому

    Thanks for simplifying the web man!.

  • @erfanm1206
    @erfanm1206 3 роки тому

    wow man you explain very well
    my mother tongue is not english but even thuogh i understand it perfectly
    you are amazing Thank You

  • @thanglenho828
    @thanglenho828 3 роки тому

    very easy to understand, thank you very much

  • @ngocminhle9127
    @ngocminhle9127 4 роки тому +1

    Very clear, very helpful. Thanks a lot :).

  • @HarshSingh-hk8fe
    @HarshSingh-hk8fe 2 роки тому

    big fan of your teaching sir :D

  • @aashayamballi
    @aashayamballi 4 роки тому +1

    Thanks Kyle... You're awesome!

  • @carlosporto8255
    @carlosporto8255 4 роки тому

    Always the best explanations videos. Keep doing this awesome work! Thank you!

  • @barman498
    @barman498 4 роки тому

    Thanks for the great explanation. Really helpful ❤️

  • @dhaneshmane
    @dhaneshmane 2 роки тому

    Very nicely explained 🙏

  • @yushsingla9905
    @yushsingla9905 3 роки тому

    God level explanation, I am glad I clicked this video!!

  • @tadeuszjiwu255
    @tadeuszjiwu255 3 роки тому

    Amazing explanation !!! Well done, thank you very much

  • @egzonberisha9906
    @egzonberisha9906 2 роки тому

    This was very helpful, thank you man :)