Pretty much the same as when using useMemo, really. If you have a memoised component, a change it props will cause it to re-render. If any of those props happens to be a function, you can put it inside a useCallback to avoid re-rendering the memoised component on every render.
Thank you for the explanation. I understand the concept. I am just not clear what impact does non-cached function makes on a component or DOM in general?
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Pretty much the same as when using
useMemo
, really. If you have a memoised component, a change it props will cause it to re-render. If any of those props happens to be a function, you can put it inside auseCallback
to avoid re-rendering the memoised component on every render.Thank you for the explanation. I understand the concept. I am just not clear what impact does non-cached function makes on a component or DOM in general?