Optimizing Rendering Performance in React

Поделиться
HTML-код
  • Опубликовано: 25 ноя 2024

Комментарии • 110

  • @SoftwareDeveloperDiaries
    @SoftwareDeveloperDiaries  2 года назад +22

    Obviously such optimizations are not necessary with a small number of re-rendered children as long as they are not too heavy. But at what point does memoizing become important? 100 items, 1.000 items or maybe 100.000 items? Share your thoughts here ✌

    • @kasemalolo5587
      @kasemalolo5587 Год назад +1

      I want to ask
      if I have a lot of element and put them in memo function Will it cause me memory problems?

    • @GuestUser-vf9qe
      @GuestUser-vf9qe Год назад

      Try to have a large form of inputs. And control this form via Formik library for validation of user input. Probably (or even highly likely) you'll face some issues with unnecessary re-rendering...

  • @JennHayden
    @JennHayden Год назад +4

    This was a great video. I am brand now to full stack development. Days old. I looked up a video he mentioned to learn about profiling and performance to speed up a build. I looked up some stuff and I go here to your video. The problem for me is I think I am a little too new to full appreciate it yet. I took notes on everything you said and I have bookmarked this. Thank you.

  • @rohan7011
    @rohan7011 Год назад +2

    the best useCallback usage and example!

  • @rubylnic
    @rubylnic 9 месяцев назад

    thank you for the great example of real life usage of these hooks! It's so precious among other explanations

  • @maximus4510
    @maximus4510 Год назад +6

    I like this channel it deserves more subscribers🔥
    you're very calm and your explanation while coding is so clear and straight to the point.
    Thank you for your quality content!

  • @shy6489
    @shy6489 Год назад +2

    mind-blowing, that's what i was searching for a very long time 🔥🔥

  • @yaakovhassoun8965
    @yaakovhassoun8965 9 месяцев назад +1

    I've seen code like this in my codebase at work and didn't really get why it was necessary, this kinda makes a lot of sense

  • @multiverse915
    @multiverse915 6 месяцев назад

    Bro explained useMemo and useCallback hook in a much easy manner 👏👏

  • @muhammadumar5385
    @muhammadumar5385 Год назад +1

    This helps get a deeper insight, very helpful. At least for a beginner like me. Keep up the good work.

  • @lukezammit88
    @lukezammit88 2 месяца назад

    Really helpful. Thanks! The useCallback solution is exactly what I've been looking for.

  • @tikamikas3245
    @tikamikas3245 Год назад

    Massive thank you!! You explained this perfectly and helped me solve an extremely annoying bug I’ve been dealing with 👏🏼

  • @germanmartinezsolis9543
    @germanmartinezsolis9543 Год назад

    Thanks bro I'm gonna use this advices for my further project

  • @AdamFiregate
    @AdamFiregate 10 месяцев назад

    Great summary and presentation! Thank you.

  • @felixdziekan7335
    @felixdziekan7335 Год назад

    Thx for the info will try that later!

  • @mrunalvaidya388
    @mrunalvaidya388 Год назад

    Watched your 10-15 videos(1st day), amazing Stuff and beautifully explained!!!!

  • @persianman72
    @persianman72 Год назад

    You saved my time with this video, thank you!

  • @girlsincode9255
    @girlsincode9255 12 дней назад +1

    nice explained

  • @jorgejorge8878
    @jorgejorge8878 Год назад

    Dude, more! First video I watched and I loved it

  • @friendsfair9283
    @friendsfair9283 8 месяцев назад

    It was a good video.
    If you create a playlists on performance optimization, that would be great❤

  • @UsmanTheDev
    @UsmanTheDev 2 года назад +1

    It was very helpful, thanks for your efforts

  • @randompointlessness2766
    @randompointlessness2766 Год назад

    Thanks ! If I knew this, I would have saved my last job 😅

  • @VictorZamanian
    @VictorZamanian Год назад +1

    But was the memo() of the child input components necessary after the useCallback() addition? Was the callback the only issue, or was memoization of the components themselves also necessary?

  • @ichigoplayss376
    @ichigoplayss376 Год назад

    Wow, Thanks a lot bro. Now I understand it

  • @costaszeimpekis994
    @costaszeimpekis994 2 года назад +1

    Very good analysis, great work

  • @prasannabiswas681
    @prasannabiswas681 5 месяцев назад

    sir can you do a same playlist for nextjs also need some glimpse of how senior software devs are writing code and folder structure in nextjs with scalability for future propects.

  • @rjwhite4424
    @rjwhite4424 7 месяцев назад +1

    I can't wait for React 19's compiler to come out so I don't have to bother with this.

  • @faridul.hassan
    @faridul.hassan Год назад

    Thank you for this awesome tutorial.

  • @stephenfoster6308
    @stephenfoster6308 9 месяцев назад

    Really useful video!

  • @archiee1337
    @archiee1337 Год назад

    Cool stuff, thanks

  • @davidcunha7615
    @davidcunha7615 9 месяцев назад

    Thanks :)

  • @havefun5519
    @havefun5519 Год назад

    Thanks for the video.

  • @netssrmrz
    @netssrmrz Год назад

    Nice video about a very common issue. Personally, issues like this is why I believe React needs to go the way of the dodo. Devs shouldn't assume that giving up control over when to render is going to magically make everything simple.

  • @kiadtisuk8857
    @kiadtisuk8857 2 года назад

    That is helpful for my work, Thanks for this vdo

  • @mistrzjuliusz9372
    @mistrzjuliusz9372 Месяц назад

    great tip

  • @easifier
    @easifier Год назад

    thank you for this quite helpful info 👍🏻

  • @mostafabrazi4228
    @mostafabrazi4228 2 года назад

    Well explained, good job👍

  • @bustopgamer5802
    @bustopgamer5802 Год назад

    Great job

  • @mohammadnoushadsiddiqi2550
    @mohammadnoushadsiddiqi2550 Год назад +1

    This will not help if we have like 15 - 20 input, radio, uploader, switches.
    Because using usecallback for all will be a problem.
    memorization technique comes with a cost.

  • @kimberlyrojas3421
    @kimberlyrojas3421 Год назад

    Really helpful, thank you!

  • @acearvingando6848
    @acearvingando6848 2 года назад

    well explained 👍 appreciate your content

  • @coolmind2476
    @coolmind2476 7 месяцев назад

    Just wondering why react doesnt do this optimizazion by default?

  • @mohdsahil226
    @mohdsahil226 Год назад

    very well explained!
    Would you please explain virtual DOM and how it updates the RealDOM?

    • @SoftwareDeveloperDiaries
      @SoftwareDeveloperDiaries  Год назад

      Hey mate! I put it on my list, but in the meantime I found this insightful article, maybe it could help you :)
      blog.logrocket.com/virtual-dom-react/

  • @keerthanachar
    @keerthanachar Год назад

    Thank you

  • @andregomes7232
    @andregomes7232 Год назад

    Amazing content! thanks

  • @ToastRusk
    @ToastRusk Год назад

    This was soooo good.

  • @minthantoo3509
    @minthantoo3509 4 месяца назад

    Can I use useMemo on that function instead of useCallback?

  • @hillelspivakov3140
    @hillelspivakov3140 Год назад

    Hi, great video. What theme are you using for your vscode?

  • @nazarkravchenko6891
    @nazarkravchenko6891 26 дней назад

    is it possible to put the useCallback in the child component so it does not care if proper callback or a function is passed?

  • @PraveenKumaran-wh5gn
    @PraveenKumaran-wh5gn Год назад

    Good One Bro..

  • @devcode9715
    @devcode9715 2 года назад

    Great job 👏

  • @anjanakaruna4095
    @anjanakaruna4095 2 года назад

    my god! why we dont use these things in our code... thanks for sharing! open some new areas to study.

  • @abrhamkindie5499
    @abrhamkindie5499 5 месяцев назад

    sorry bro , can you give me some thing for my project.
    my mernstack project brings some featurs late. so what my be the solution or what is the problem

  • @zainkhas93
    @zainkhas93 Год назад

    Quality content!

  • @oleksandrluchytskyi6867
    @oleksandrluchytskyi6867 Год назад

    can we pass parameters to the useCallback((id: number) => () => setSelectedId(id),[]); ?

    • @SoftwareDeveloperDiaries
      @SoftwareDeveloperDiaries  Год назад +1

      Yes, you can:
      beta.reactjs.org/reference/react/useCallback

    • @oleksandrluchytskyi6867
      @oleksandrluchytskyi6867 Год назад

      @@SoftwareDeveloperDiaries ah… this example works for me, thanks 👍 e.g. (I need to call useCallback for each list item in a loop, but it’s not allowed)

  • @Amamamamwnwb
    @Amamamamwnwb Год назад

    Don’t set the editor to dark mode unless you set browser too. With screen bliking black and white, my eyes hurt. Thanks for great video though.

  • @ДенисМалышок
    @ДенисМалышок Год назад

    And what about the context? Is there a way to improve performance of that? Because since context update one of its values, the whole value gonna be considered as a new one, and all of the components that have hooked useContext will be rendered Iven they have memo on them

    • @SoftwareDeveloperDiaries
      @SoftwareDeveloperDiaries  Год назад +2

      Thanks for a great question. I think this might be useful:
      stackoverflow.com/questions/57030018/react-context-with-hooks-prevent-re-render

  • @suryakumara3360
    @suryakumara3360 Год назад

    Hi, why not putting id, and value in callback dependencies ? so it will be triggered when the id or value changes.

    • @SoftwareDeveloperDiaries
      @SoftwareDeveloperDiaries  Год назад

      Unless I misunderstood you, this way it will still rerender the whole component.

    • @suryakumara3360
      @suryakumara3360 Год назад +1

      @@SoftwareDeveloperDiaries Got it, I don't code in hand.

    • @jagjot1697
      @jagjot1697 Год назад +4

      id and value are probably of type 'String' or 'Number', which are both primitive types (includes string, number, boolean etc.) in JS. On each re-render of the parent, anything which is not a primitive data type - it could be an array, a function, or an object - all these are re-created (re-assigned a new reference/location/address in the memory) by the parent component because these are referenced by memory. All the primitive values are not re-created and hence, those do not change on the parent's re-render, which is why we don't need to 'cache' primitive values.

  • @mase-ob1vf
    @mase-ob1vf Год назад

    KING

  • @hund1267
    @hund1267 Год назад

    Handler shouldn't recreate if you lift it above the component, or?

    • @SoftwareDeveloperDiaries
      @SoftwareDeveloperDiaries  Год назад

      Great point, it won't indeed! There are different opinions on this approach as well as small implications tho: stackoverflow.com/a/62925172

  • @symphony86
    @symphony86 Год назад

    I never have to think about all these doing angular or vue.. never have any issue with performance or lagging.. only react.. whyyyy

  • @vaibhavsalve2024
    @vaibhavsalve2024 9 месяцев назад

    Helpfull video. I Nee help.

  • @juliansyah4byte57
    @juliansyah4byte57 Год назад

    You get my sub and turn on bell

  • @timelimitexceeded0
    @timelimitexceeded0 Год назад

    Why not just take out the function out of the component instead of using useCallback

    • @SoftwareDeveloperDiaries
      @SoftwareDeveloperDiaries  Год назад +1

      Indeed! There are different opinions on this approach as well as small implications tho: stackoverflow.com/a/62925172

  • @AkioJunichiro
    @AkioJunichiro 2 года назад +1

    Seems interesting but you speak wet, it's hard to focus

  • @bradyfractal6653
    @bradyfractal6653 2 года назад +1

    I think you mispronounced “use Svelte” 😂