Freecodecamp Project: Javascript Calculator

Hello, this is my next project on Front End Libraries Project https://codepen.io/indrasubagja/pen/RwGwYoG. Feel free to give me some feedback. :slight_smile:

1 Like

Hi,

The styling is quite beautiful. Very sophisticated.
As to the js I have to confess I feel overwhelmed by the amount of code. I can’t look at everything there is just too much.
I am an amateur and everything I know about React I learned on FreeCodeCamp. Consider my opinion like that.
What struck me, is that you use a lot of ‘addEventListener’ code in your code. As I understand it, React allows us not to do that anymore which is one of the advantages of react for me. But you’re using many of them and removing and adding them.

I’ve tried to step through all that code and I get lost in it. But then, I may not at all be seeing what you’re actually doing. Why do you add eventlisteners on focus? What are all these keyCodes about? I don’t know. So, I’d like to understand you better.

Greets,
Karin

@mientje Hello, Karin.

Thank you for spending your time in this post. I actually not sure that my code is fulfill clean code rule since I mostly just fixing error one by one using if else statement. I’ll try to improve it as fast as I can.

And for addEventListener, I think that’s the way to manipulate other element with componentDidMount. If you have better way, please let me know.

Lastly, for eventListener onfocus and keyCode, that’s the way that comes up to my mind when trying to improve keyboard accessibility.

Hi,

I think you can simplify the code a lot. Everything works, so that’s good. But, if you work in a company it is possible that you have to work on someone else’s code and others on yours. So, simple code is good because it’s readable and easily understood. I don’t see any comments anywhere that explain what you are trying to do. I would start commenting. Why you are doing what. It will help me to understand what you are doing. And then I’d like to take a more detailed look at it. I’ve not seen this kind of code anywhere so you are certainly original. I can probably learn a thing or two from you.

Greets,
Karin