React Calculator - bug fix

I need help getting the event handler onKeyPressed to trigger when I click on a number key.
Been stuck for a while now. Can someone please explain why it’s not working and how I would get it to work. Thanks so much in advance.

See the Pen React Calculator by Kristian (@Kristians) on CodePen.

I fixed the onKeyPressed bug. I don’t know why it’s not passing the 7th test. I have ‘0’ , can someone please explain why its not reading that?

Hello Kristian,

Looks like test expected a non-input element like div, span. It seems test looking for element inner content rather value attribute(the input way in your page)

Simply find the function present the display section (DisplayWindow) and manage to show the result using a tag like span rather input and make sure you set the result as tag content. This will pass the 7th text but it still has some more small issues you would fix very easy.

Happy coding.

Thanks, that helped! I am now working on tests 11 & 13 it looks like I can solve both with using RegEx , the only problem I have is how I could implement RegEx into my current code , maybe a ‘else if’ statement in the onKeyPressed event handler? And how would I go about doing that? If you could help me with that I would greatly appreciate it. An explanation would be great. Thanks in advance!

I’ve done my very best to handle using the decimal button but I still can’t pass all the tests. Can someone please help!