Open Matilda0730 opened 10 months ago
라는 오류가 떠서 30분동안 헤맸는데 useSeclector로 리듀서를 끌어올 때엔 key값을 써야한다는 걸 알았다 const { products } = useSelector((state) => state.cartSlice) 이렇게 쓰면 오류남 const { products } = useSelector(state => state.cart); 이렇게 써야 오류 안남 왜냐면 store에서 등록할 때 아래처럼 등록해놨기 때문이다.
const { products } = useSelector((state) => state.cartSlice)
const { products } = useSelector(state => state.cart);
reducer: { products: productsReducer, auth: authReducer, cart: cartReducer, }, });`
라는 오류가 떠서 30분동안 헤맸는데 useSeclector로 리듀서를 끌어올 때엔 key값을 써야한다는 걸 알았다
const { products } = useSelector((state) => state.cartSlice)
이렇게 쓰면 오류남const { products } = useSelector(state => state.cart);
이렇게 써야 오류 안남 왜냐면 store에서 등록할 때 아래처럼 등록해놨기 때문이다.