Skip to content

When to use useMemo hook in react? #354

Answered by fcasamento
ChrisHagedorn asked this question in Q&A
Discussion options

You must be logged in to vote

@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

const rules = [
 '8 characteres',
 'lowercase word',
 'uppercase word',
];

// Lista de erros
const Errors = ({ active }) => {
  return active && (
    <ul>
      …

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@ChrisHagedorn
Comment options

Answer selected by AbidHasanPiash
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants