javascript – SetState does not update after the reminder

I do not understand what's wrong with my code. I know this question is asked often, but after a few tries, I can not solve my problem. I've tried to follow these questions before posting something:

Problem

Update the status of the table when I'm calling printResult ()

My code

operationResult () {
expression const = this.state.operations.join (& # 39;);
leave result = 0;
result = eval (expression);
this.setState ({operations: [result]}, a function () {
console.log (this.state.operations)});
this.printResult ();
}



handleInput = (e) => {
const buttonClicked = e.target.value;

switch (button clicked) {
case "clear":
this.setState ({
operations: [],
})
Pause;

case "equal":
this.operationResult ()
Pause;

case "float":
Pause;

case & # 39; ± & # 39;
if (this.state.operations == undefined) {
console.log (& # 39;) error;
return;
}
Pause;

default:
const newOperation = this.state.operations;
newOperation.push (buttonClicked);
this.setState ({operations: newOperation})
console.log (this.state.operations)
Pause;
}
}

I understand that the function this.printResult () work before the reminder in the setState, so the state of operations is not already updated when I call it.
there is something I can do to update the table before I call this.printResult () ?