nss-day-cohort-46 / How-to-Ask-for-Help

0 stars 0 forks source link

type note found on card, been stuck for a few hours #86

Closed Younique98 closed 3 years ago

Younique98 commented 3 years ago

Ticket MUST be completed before getting help from an instructor

Name: Erica Thompson

Group: None

#### Book / Chapter: Kandy Korner Chapter 10 #### Have you searched the other issue tickets? If not, do that first. - [x ] Yes - If No, stop and search. #### REQUIRED Add Tags to Issue Ticket and Assign to Project Board

REQUIRED Describe your issue:

I have created a function to map over products and pull the information for the type.

REQUIRED List any error messages that appear:

TypeError: Cannot read property 'type' of undefined

REQUIRED What have you googled? (You must have at least 3 links related to your issue)

REQUIRED: What have you tried? Tell us everything you have tried.

I have tried walking through the code which led me to the Product Context on the Product Provider which seems to be just fine. It is connected to setProducts from useState.

REQUIRED: Copy/paste link TO THE FILE on your branch that you are having issues with

Your link: https://github.com/Younique98/KandyKorner/blob/9236d37c045d3ae503260273d1d65061325b1a85/src/components/products/ProductCard.js#L37

Code Snippet

PASTE YOUR CODE HERE BETWEEN THE BACKTICS

<div className="product__price">Price: {productProps.price}</div> {/* <div className="product__productType">ProductType: {productPicked.type}</div> */} {products.map(product => { const productPicked = products.find(productPickedAndPurchased => productPickedAndPurchased.id === product.locationId) {console.log(productPicked)} return <div className="product__productType">ProductType: {productPicked.type}</div> })}

Younique98 commented 3 years ago

@ajawashington I will try that. Thank you for replying

Scott47 commented 3 years ago

@Younique98 Is this resolved? I know you aren't working on kandykorner right now, but I wanted to check.