New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
assigment by shivamg11000(shivam gupta) #5
base: master
Are you sure you want to change the base?
assigment by shivamg11000(shivam gupta) #5
Conversation
Good Job @shivamg11000. We will review it after the contest. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Convert components using Class syntax to Stateless functional Components and use camelcase naming convention.
import React from 'react'; | ||
import './Cart.css'; | ||
|
||
class Cart extends React.Component{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This Component can be converted to a Stateless Functional Component. Just like the others. For more info Click Here
} | ||
|
||
handleAddToCart(itemKey){ | ||
const no_of_cart_items = this.state.cart.no; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Camel case is preferred in JavaScript based projects. Corresponding Airbnb style guide rule
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know but for such big variables snake case is more readable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about this react lifecycle method then - `componentWillReceiveProps()'?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ofcourse we have to use it , snakecase will not work here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was trying to convey that "componentWillRecieveProps" is long variable name and yet camel case is used here.
|
||
|
||
|
||
class OrderSummary extends React.Component{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class can also be converted to Stateless functional component.
|
||
import './Shop.css'; | ||
|
||
class Shop extends React.Component{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class can also be converted to a Stateless functional components
|
||
import './ShopItem.css'; | ||
|
||
class ShopItem extends React.Component{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Convert all classes that either does not have state or won't have state in future, to a stateless functional component.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add comment wherever required to understand the code implementation intention
Make code more readable
Update README file with all required instruction to setup project.
done the assignment, took the same idea of e-commerce and implemented it.