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:
- How can I fix the immediate error associated with my
handleClick
function? - Is the code that I have written thus far within my
handleClick
function optimal for this function’s functionality? - I’ve attempted implementing
handleClick
withonClick
in mycalculator
div
:
<div className="calculator" id='calculator' onClick = {handleClick}>
. However, this does not seem to be working. Do I need to be implementing myhandleClick
function someplace else?
Thank you for your help, .
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: