When to use useMemo hook in react? #354
-
me just have smol brain |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
@ChrisHagedorn Hope to help. It consists of storing the return value of a function from the input values (Parameters). That is, if a sum function takes parameters 2 and 3 and returns 5, these values will be stored, and when this function is called with the same parameters, it will not need to redo the calculation to get the return value, since this function will be stored.
|
Beta Was this translation helpful? Give feedback.
-
The useMemo Hook can be used to keep expensive, resource intensive functions from needlessly running. |
Beta Was this translation helpful? Give feedback.
@ChrisHagedorn Hope to help. It consists of storing the return value of a function from the input values (Parameters). That is, if a sum function takes parameters 2 and 3 and returns 5, these values will be stored, and when this function is called with the same parameters, it will not need to redo the calculation to get the return value, since this function will be stored.
Source: https://gist.githubusercontent.com/LucasCalazans/cb653a56a48f8e53c539807b7eca8c9b/raw/b2a37fd68ab4e6b7a9a6ae9d9addb526697d1e1c/no-usememo-form.js