Hi, I’m working on the Front End Libraries project for the javascript calculator and I’ve hit a wall. I can’t seem to make the state update properly in my reducer function.
Right now all of my action creators are working, but whenever I hit one of the operator buttons everything seems to sort of break. The formula in the state doesn’t seem to update and remains as undefined. My brain is currently fried from trying to figure this out and I don’t know how to explain it more clearly so here is a screenshot of the console output and the calculator display with a simple calculation, as well as the codepen:
I’m sure there are a ton of other problems with how I’ve written other sections of the program but I’m trying to focus on this as it’s what I’m having the most trouble figuring out currently. For example, I haven’t yet started making any more functions to check the formatting of the formula as I can’t even get the basics of updating the variables in state.
My equals button is also not working but I’m not sure if this is a separate problem with my code or simply because it’s trying to use the null value from the piece of state I can’t update. Thanks in advance for any help!