Trouble with handleClick function in Javascript Calculator

Tell us what’s happening:

I’m having a lot of difficulty getting the handleClick function in my Javascript Calculator to function. Currently, my handleClick function is throwing an undefined error.

Failed to compile
src/App.js
  Line 60:60:  'handleClick' is not defined  no-undef

Search for the keywords to learn more about each error.

I’m also interested in whether the code I have written within my handleClick function is part of the problem?

Specifically, my questions are the following:

  1. How can I fix the immediate error associated with my handleClick function?
  2. Is the code that I have written thus far within my handleClick function optimal for this function’s functionality?
  3. I’ve attempted implementing handleClick with onClick in my calculator div:
    <div className="calculator" id='calculator' onClick = {handleClick}>. However, this does not seem to be working. Do I need to be implementing my handleClick function someplace else?

Thank you for your help, :pray:.

Your code so far

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.192 Safari/537.36.

Challenge: Build a JavaScript Calculator

Link to the challenge:

Refer to this for accessing class methods.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.