Uncaught SyntaxError: Unexpected end of input using React

I understand it’s not what is causing the problem. From you’ve said, the problem comes from the state not being accurate when I use setState, so I need to have variable that is equal to the display + event target value. That’s what I think anyway?

I mean, when I fix that setState problem, I still have that issue, it’s just now that instead of after I press 1 + 1 now it happens after 1 +. It’s still happening it’s just that now it is happening at the “right” time.

So, ultimately, the error is that you are sending eval something that isn’t valid JS. You are sending 1 + and it doesn’t know what to do with it.

Are you sure that that’s when you want to call eval?