bradtraversy / proshop_mern

Shopping cart built with MERN & Redux
1.99k stars 1.18k forks source link

Hey, I am getting this weird error and I can't figure out what's the issue. #77

Closed kiranojhanp closed 3 years ago

kiranojhanp commented 3 years ago

Screenshot: image

Github: Repo

talmax1124 commented 3 years ago

This is for bugs only. Please ask in Q&A.

Anyways copy this:

const dispatch = useDispatch()

const productList = useSelector((state) => state.productList) const { loading, error, products, page, pages } = productList

useEffect(() => { dispatch(listProducts()) }, [dispatch])

Sent from my iPhone

On Nov 27, 2020, at 4:08 AM, Kiran Ojha notifications@github.com wrote:

 Screenshot:

Github: Repo

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

talmax1124 commented 3 years ago

Look at the repo as well. https://github.com/bradtraversy/proshop_mern

Sent from my iPhone

On Nov 27, 2020, at 10:14 AM, SlashTalmax Cd carlitosdiazplaza@gmail.com wrote:

This is for bugs only. Please ask in Q&A.

Anyways copy this:

const dispatch = useDispatch()

const productList = useSelector((state) => state.productList) const { loading, error, products, page, pages } = productList

useEffect(() => { dispatch(listProducts()) }, [dispatch])

Sent from my iPhone

On Nov 27, 2020, at 4:08 AM, Kiran Ojha notifications@github.com wrote:

 Screenshot:

Github: Repo

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

basir commented 3 years ago

Screenshot: image

Github: Repo

when you get this error: Action must be plain text, it means you did not add redux-thunk middleware to the redux store. check store.js https://github.com/bradtraversy/proshop_mern/blob/master/frontend/src/store.jshttps://github.com/bradtraversy/proshop_mern/blob/master/frontend/src/store.js

also please ask your errors and questions on udemy Q/A. Create an issue here only if you found an error in this code, not yours.

kiranojhanp commented 3 years ago

Yeah I should've sent on udemy. My bad!! Thanks for the help. The issue was I forgot an arrow function in productAction. changed export const listProducts = async (dispatch) => { to export const listProducts = () => async (dispatch) => { which solved it.