14 - useCallback and useMemo React Hooks - When to Use useCallback and useMemo

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

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

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

    Video TOC
    0:00 - Introduction
    00:23 - What is Application Performance?
    01:46 - What are useCallback and useMemo?
    07:45 - Usages of useCallback and useMemo
    11:47 - useCallback and useMemo Examples
    22:58 - When NOT to use useCallback and useMemo?

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

    It's actually too valuable for React Developer. You did a lot of effort to make this video as much as valuable for the learners, Hats off to you.

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

      Thanks a lot for the encouraging words. It means a huge when someone appreciates the hard work behind the content creation.

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

      @@tapasadhikary Its my pleasure

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

    Great stuff! practical examples which we come across during app building and clear explanation. thank you for simplifying these concepts in React.

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

      You are most welcome Abhinaya... Keep learning.👍

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

    Good explanation. The warning you make is important, these hooks should only be used with just cause.

  • @user-vh7gq5fi8b
    @user-vh7gq5fi8b 3 месяца назад +1

    Hi Tapas, can you please make a another video briefing the differences between useMemo vs useEffect

  • @sanjaymajhi4428
    @sanjaymajhi4428 11 месяцев назад +1

    Love it man 🎉❤

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

    Nice one i should say best one
    Thanks for explaining in a easy and understandable way :)
    I get my answer why should we use useCallback() and useMemo()
    Thank you so much
    Really a good video
    I saw some videos they are also good but the question that comes in my head that yeah its use for performance but in which way and which performance i was unclear about that one
    now it's clear fully
    Again
    Thanks a lot :)

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

    Sir, the value of 'this' is lexical(static) scoped or dynamic scoped? I have a confusion. I think it's dynamic scoped because it gets its value through execution context. But I have already learned, JavaScript only uses lexical scope.

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

      The value of ‘this’ depends on where it is used and invoked. The context of usage. From that perspective, the value of this is dynamic based on the function, and object it is associated with.
      I wouldn't use the word dynamic scope or lexical scope with this. Scope is determined the visibility of a variable. It doesn't determine the value if ‘this’. The value of this is determined by the function invocation and usage of this with respect to it.
      This may be helpful: www.freecodecamp.org/news/javascript-this-keyword-binding-rules/

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

    Please make a video on useContext and useLayoutEffect.

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

      Next video coming a short one on props drilling and then useContext with example.

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

    Hello Tapas, Thank you so much for the video. I understood the usage of the useCallback and memo. However I tried to modify the GreetingBox component by passing in name (const [name, setName] = useState("");) as the prop like instead of this .
    I tried displaying the Hello name in GreetingBox. My doubt is , IS there a difference when we send state (name) as a prop instead of a function(getGreeting) ? Because useEffect is not called when state is passed as prop whereas when we pass in as a function I can see Useeffect getting called whenever the button is clicked.
    like

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

      i guess the thing is getGreeting function is being recreated on every render that's why when we are passing the getGreeting function as a prop without using callback to the GreetingBox component and using it as the useEffect dependency , getGreeting is being treated as a new function which is why the useEffect is running , on the other hand when we are sending a state variable as prop to the GreetingBox component it is not being recreated or lets say not being changed on every render that is why useEffect is not running because its dependency has a state variable as a prop which has not changed .

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

    Why don't you show the example for useMemo

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

      Let me know what example you look for.

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

      @@tapasadhikary usememo example

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

      @@lingarajhiroli965 Got it. Shall capture it any of the related video.

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

    Sir can you give one practical example about Redux

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

      I’m going in steps in the series. Next is context and after that I will start with redux. Thanks!

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

      Thanks alot

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

      Nikhil, I hope you watched the first video from the Redux series.

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

      Yes i watched it was amazing video your explanation has erased my confusion on redux

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

      Thank you so much

  • @suryapeddireddy7810
    @suryapeddireddy7810 11 месяцев назад

    But u r example for callback also work using usememo also😅