Skip to content

Conversation

ASPhillips8
Copy link

Used used Effect to code along with lab to handle CRUD application. Used get to fetch item data and display list. Used POST to add new items to list. Used POST to update data base on if item was in cart. Used Delete to remove item from shopping list
Screenshot 2024-06-17 at 3 35 22 PM

Copy link

@stephenmckeon stephenmckeon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great work (besides the extra line :P)! It's not the end of the world, but PLEASE try to make sure you're giving yourself a code review before you submit your work to me. I expect the code to be in a "production ready" state by the time it gets to me. I won't make you go back this time, but going forward, I will. Regardless, the concepts are there and you're doing an awesome job. Keep it up! And don't let the little things ruin all that hard work.

Comment on lines 3 to 5
function Item({ item, onUpdateItem, onDeleteItem }) {

function handleAddToCart() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do this in almost every lab!! PLEASE PLEASE PLEASE PLEASE PLEASE try to get out of this habit. I'm going to make you go back and delete these lines until you you stop... sorry!

Suggested change
function Item({ item, onUpdateItem, onDeleteItem }) {
function handleAddToCart() {
function Item({ item, onUpdateItem, onDeleteItem }) {
function handleAddToCart() {

Comment on lines 11 to 12
body: JSON.stringify({isInCart: !item.isInCart
}),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
body: JSON.stringify({isInCart: !item.isInCart
}),
body: JSON.stringify({ isInCart: !item.isInCart }),

Comment on lines +3 to 4
function ItemForm({ onAddItem }) {
const [name, setName] = useState("");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See, this is what I'm looking for!

}

function handleAddItems(newItem) {
console.log("in Shopping", newItem)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
console.log("in Shopping", newItem)

@ASPhillips8
Copy link
Author

Sent updated code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants