React Calculator - can't find the issue

Hello guys!
I’m working on the jS Calculator and trying to do it with React but it’s like an hour that I’m trying to understand why my code doesn’t work. I think, the problem could be between line 98 and 109, because I tried to put a test button there, and in that case when I click it, the state is updated.
Here is the code:

Nicolò

i would say first begin with attempting resolving test cases “synchronously” rather than all at once

for instance by using just this id={this.props.id} in your Button component almost 50% test cases are passing, perhaps thats a start to decode this, good luck :slight_smile:

2 Likes

Actually I forgot to reorder the code, and it was already done this part, now I fixed that.
My problem, specifically, is that I can’t understand why the handleNumber doesn’t take the e.target.value. I tried to console.log it, and it says that e.target.value is undefined.
Now I tried put a <button> isntead of a <div>, and it works like I want, but no, I have not yet understood why. I mean, it seems that a <div> element is not triggered by the onClick event. Right?

it will, but you’ll have to use “textContent” instead of “value” if you are to use with a “div” instead of “button”

1 Like

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