JavaScript Calculator React/Redux Project Feedback CH

I finished my JavaScript Calculator using React/Redux, and I was wondering if there are any best practices I’m missing on or anything that could have been done simpler or more efficiently.

Take a look here: https://codesandbox.io/s/rw0j2orqmp

Thanks!

I think it could been done much simpler. yours looks great and I loved how it handled neg. numbers and did not use eval all a big plus. redux seems like over kill ,but it functions well. Here is mine if you want to see a super simple one. I did not use eval and kept it very simple. Nice job

https://reactcalfinal.herokuapp.com/ - project

https://github.com/joshuaaguilar20/ReactCalculator1/blob/master/src/app.js (actual app code)

1 Like

Thanks for the feedback! I did actually use eval though in the METHODS and EQUALS switch case. I couldn’t find a suitable replacement to do the calculations. What’s a good alternative to that?

@cdhippen

there are a couple. I found it a fun challenge to not use it as it was not needed (ex logic). There are a few for security, (npm safe-eval no pun intended), and a plugin called jexl- https://github.com/TomFrost/Jexl

1 Like

Cool, I’ll give these a look!