Closed kiranojhanp closed 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.
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.
Screenshot:
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.
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.
Screenshot:
Github: Repo