[Javascript Calculator] setState not run as expected

Hello, I’m building my JS calculator, I have this block of code (handleEqual() in Calculator Component )to calculate and set the result in the state of the calculator, I expected the setState() to run everytime I click the “=” button but it doesn’t, could anyone explain to me why is that? Thank you very much! This is my code:


There is an inconsistency with your variable names:

  this.state = {
            currentText: "",
            previousValue: "",
            result: "0",  <-- here
            firstClick: true,
            evaluated: false


<ResultScreen value={props.result}/> <-- here


 resultText={this.state.resultText}  <---and here 
1 Like

Wow thank you so much! I didn’t thought about that, I thought it would be a problem in my logic or something like that and I tried a whole day to solve it but i couldn’t. :smiley: Very appreciate your support

Sometimes when coding, you won’t see the wood for the trees :wink:

Glad to help & happy coding!