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

0 stars 0 forks source link

.then of undefined #14

Closed Ccourter11 closed 3 years ago

Ccourter11 commented 3 years ago

Name: (Since we don't know you by your github handle) Calvin

Group:* (if applicaable)* Han Coco

Book / Chapter:* (if applicable)*

Have you searched the other issue tickets? If not, do that first.

REQUIRED Add Tags to Issue Ticket and Assign to Project Board (Check these prior to creating the issue ticket)

These can be added in the column on the right

REQUIRED Describe your issue:

Honestly just need some direction, am not sure what I'm doing wrong.

REQUIRED List any error messages that appear:

PASTE ERROR MESSAGE HERE
``` ProductList.js:14 Uncaught TypeError: Cannot read property 'then' of undefined
    at ProductList (ProductList.js:14)
    at main.js:14

#### REQUIRED What have you googled? (Paste links to the things you have found from your google search - You must have at least 3)
- [ ] 1. https://css-tricks.com/%E2%80%8B%E2%80%8Bavoiding-those-dang-cannot-read-property-of-undefined-errors/
- [ ] 2. http://net-informations.com/js/iq/unerror.htm#:~:text=JavaScript%20TypeError%20is%20thrown%20when,method%20on%20an%20undefined%20object%20.
- [ ] 3. https://www.lambdatest.com/blog/undefined-type-error-in-javascript/

#### REQUIRED: What have you tried? Tell us everything you have tried. 
>> tried a .then and tried redefining the variables

#### REQUIRED: Copy/paste link TO THE FILE on your branch that you are having issues with
We will not accept links to the whole repo. You must provide a link directly to the specific file
**Your link:**
https://github.com/nss-day-cohort-46/sprinkles-of-joy-han-coco/blob/main/scripts/products/ProductList.js#L13

#### Code Snippet

export const ProductList = () => { getProducts() .then(getCategories) .then(() => { bakeryProducts = useProducts() bakeryCategories = useCategories() render() }) }

jisie commented 3 years ago

@Ccourter11 Try reading through this and let us know if it helps: Error: then of undefined

sageklein commented 3 years ago

@samj0516 and @blusanders check out this error and the comments, it might be useful for you as well.

Ccourter11 commented 3 years ago

Got it fixed, thank god! S/O Jisie