r/reviewmycode • u/lunny93 • Jun 21 '17
Javascript [Javascript] - Online Store
Recently, I was given an interview assignment to create an online shopping store. I decided to build the store in React/Redux. The specifications were easy as they are basic functionalities. I didn't hear back so I was wondering what was wrong with my code.
Since it was a small project, I structured my code in Rails project directory.
2
Upvotes
2
u/violent-guitar Aug 20 '17
I can not answer why you did not hear back from the company, and I assume that the online store works (I have not run the code). But here's some thoughts from someone who's been working professionally with JS for a couple of years:
This code is hard to read, some whitespace characters would help
==>
The linter we use at work would not accept your code to be merged into master.
.map(),.filter()and.reduce()instead. Not only will it make the code easier to read, it shows (to my at least) that you can use more advanced methods for data manipulation than those who are just starting with programming..bind()in the constructor instead of in.render(), otherwise you will execute it with every render which is unnecessary.redux-thunk? You are not doing any async requests so I don't see any reason to use it, by including it you are adding unnecessary complexity.The architecture looks pretty default to me so I don't have anything to say about that, hence my nit-picky comments. To me having a consistent code style with self-explanatory code is important. It's like being nice to your future self and to your colleagues who most likely are the people who will have to maintain your code when you stop working with it.