강의

멘토링

커뮤니티

Inflearn Community Q&A

gkswogur123314's profile image
gkswogur123314

asked

Full Stack React Live Coding - Creating a Simple Shopping Mall

4일차 장바구니에서 오류가 납니다.

Resolved

Written on

·

399

0

안녕하세요 4일차 공부를 하던중 willpay를 cart 에서 밖으로 꺼내 willpay-index.tsx 로 변경하게 되면서 캡처.JPG이러한 오류가 뜨면서 장바구니가 담아지지 않습니다.(장바구니가 비어있을 때는 비어있다는 텍스트는 출력이됩니다) 코드상 오류 표시는 안나는데 해결이 안되서 여쭤봅니다. 감사합니다.

reactfirebasegraphql

Answer 1

0

jaenam님의 프로필 이미지
jaenam
Instructor

코드를 보여주셔야 알 수 있겠네요.
깃헙에 올려서 공유해 주세요.

일단 에러메시지만 봤을때는

createdAt이라는 정보를 읽어오려는 대상이 객체가 아닌 undefined라고 합니다.
createdAt 프로퍼티를 보유한 객체가 왜 undefined인지를 찾아내면 되겠네요.

gkswogur123314님의 프로필 이미지
gkswogur123314
Questioner

https://github.com/JaeHyuk1217/JH_mall/tree/master/shopping-mall/src

입니다. 확인 부탁드립니다.

감사합니다.

jaenam님의 프로필 이미지
jaenam
Instructor

  1. mocks/handler.ts 파일에 오타가 있네요.
    createAt => createdAt

  2. components/cart/index.tsx 파일의 아래 부분이 잘못되었습니다.

    const enabledItems = items.filter(item => item.product.createdAt)

    item에는 product 프로퍼티가 없습니다. item.createdAt으로 작성하시면 되겠습니다.

gkswogur123314's profile image
gkswogur123314

asked

Ask a question