I have built a Calculator with React as per one of the project challenges mentioned in Front End Libraries Certification.
I have completed all the User Stories in the requirement and also added additional functionalities like support for keyboard input, backspace key, +/- key, etc.
The additional keyboard support is a great touch. If you’d like a bonus challenge, I would suggest looking in to installing and importing the math.js library to replace your eval() call.
Thanks for taking time and going over the project!
Actually regarding using library for eval() calls, I wanted to keep the project vanilla/ with least libraries as possible.
But I agree with you as it seems that for removing eval() calls, using library like math.js is bit necessary as I guess it will be bit complicated to perform string input calculations in this scenario with vanilla JavaScript.
Also, one query I have that is can we pass html entities to functions? For reference, in Button.js component, for multiply and divide (and all operator) buttons I have used html entities to display the respective symbols for them. But I also want those symbol on the calculator display (for multiply and divide). But I am not sure how to pass the html entities for those symbols through the function to Button component. So I have passed strings - *, / for multiply, divide respectively. Do you got any idea regarding this?