DEV Community

vinodchauhan7
vinodchauhan7

Posted on

React Calculator!!

Top comments (8)

Collapse
 
fantasticsoul profile image
幻魂 • Edited

cool, but your code is not beautiful
1, bad switch case
2, bad button component creation process

see my version( powered by concent)
Completely separate UI and logic!
codesandbox.io/s/react-calculator-...

and I found a bug when I migrate your code
when I input 3*50, the result is 750 !!!

you can fix it on my codesandbox mentioned above or yours

Collapse
 
sunflower profile image
sunflowerseed

the 3 * 50 becomes 750 bug is not fixed yet (as of Feb 20, 2021)

Collapse
 
fantasticsoul profile image
幻魂

input 888-666, the result is 150

Collapse
 
vinodchauhan7 profile image
vinodchauhan7 • Edited

Hey thanx for doing the thorough testing of the app, Its really great of you for doing this. Will check the logic and update the needfull.

Collapse
 
fantasticsoul profile image
幻魂

thank for your reply, if you have fixed it just let me know, I will copy it to my concent version.

Collapse
 
fantasticsoul profile image
幻魂

another bug founded:

try input 5-6+1, the result is Start Calculating

Collapse
 
nikhilknoldus profile image
Nikhil

Hey, this article is a head start for this concept not an assignment, so that's why it is in open space, you're free to work on it and update the code & bugs as you want. Overall I like it as it gives me space to work and improve on it, not just copy and use further. I guess you're promoting "concept" although that is nice, but put your testing in a single comment as it demotivates the readers. :)

Collapse
 
fantasticsoul profile image
幻魂

concent is a totally new state management for react, born for build large and high performance react app, hope you like it