Referencing a variable declared after a callback #57
              
                Unanswered
              
          
                  
                    
                      aleclarson
                    
                  
                
                  asked this question in
                General Questions
              
            Replies: 0 comments
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
In this case,
onClickcannot be memoized, sincefoo's value is unknown at the time ofonClick's declaration.Q: Should the eslint plugin report an error about this?
Edge case: If the two callbacks reference each other, it's maybe better for the eslint plugin to stay silent about it.
Beta Was this translation helpful? Give feedback.
All reactions