Need help with React Calculator

Hello,

I’ve been trying to write a React Calculator from scratch on my own for a little while now.

Here’s the codepen: https://codepen.io/usernameonline/pen/wvwYdRp?editors=0010

Can anyone help me to understand why it is not passing rule 11 for the FreeCodeCamp challenges?

When I run the tests, 11 passes.

You are failing 7, 9, 10, and 13.

Hm okay.

I meant to say not 11 but rule number 8, which shows as not passing when I run tests. When you click numbers it does update the element with the id of display which is set to a state property. But for some reason it doesn’t pass

If you look at the first line of the failure you will see this:

Numbers do not display correctly within id=“display” : expected ‘0123’ to equal ‘123’

So that’s the problem and why the test is failing. If you type in numbers the zero sticks to front of the number when it shouldn’t.

0o0o0o0oh okay…

I’ve fixed the problem lol. It’s now passing rule 8. Now to figure out the rest of this mess haha. Thank you for your help!

No problem. :slight_smile: Glad you could figure it out!

Yes, it’s really helpful to see why exactly the test is failing. Good luck with the rest of it. It’s not a simple project!