Open RITESHKUMAR10 opened 4 years ago
I am facing the same problem. @basir sir can you take a look at that issue?
ok, i solved the problem.
I have the same problem. How did you solve this ? @amabirbd
@yaprakbulut most probably it's a typo . I forgot a "_" .
I changed
x._id !== product.id
to
x._id !== product._id
@amabirbd No, this didn't solve. I checked the code but there is no wrong there. Also when my code keeps failing, I copied and pasted @basir ' s code, it still gives the same error.
@amabirbd No, this didn't solve. I checked the code but there is no wrong there. Also when my code keeps failing, I copied and pasted @basir ' s code, it still gives the same error.
yes that happened to me too . check other files connected to that file like your cartReducer and store .
@yaprakbulut and most importantly, don't forget to restart your pc ;)
I got the same error too. Not sure how to solve it. @yaprakbulut Did you find the solution ? @amabirbd I checked my code and there seems to be no typo
@RITESHKUMAR10 @amabirbd @yaprakbulut I think I found my solution too. In /components/Cart.js,
I missed adding {} around removeFromCart
Previously it was, export default connect((state) => ({ cartItems: state.cart.cartItems, }), removeFromCart )(Cart);
and I changed the above code to
export default connect((state) => ({ cartItems: state.cart.cartItems, }), {removeFromCart} // This is where I forgot to add the {} )(Cart);
@amabirbd I agree with you. Looks like only if we are missing something in the connected files, we are getting this error.
PS: If you are following udemy course videos and doing exactly as the professor says then it looks like the instructor forgot to add these curly braces {} while coding.
Hope this helps
@ebbie that's probably it. Are you taking the udemy course?
@RITESHKUMAR10 @amabirbd @yaprakbulut I think I found my solution too. In /components/Cart.js,
I missed adding {} around removeFromCart
Previously it was, export default connect((state) => ({ cartItems: state.cart.cartItems, }), removeFromCart )(Cart);
and I changed the above code to
export default connect((state) => ({ cartItems: state.cart.cartItems, }), {removeFromCart} // This is where I forgot to add the {} )(Cart);
@amabirbd I agree with you. Looks like only if we are missing something in the connected files, we are getting this error.
PS: If you are following udemy course videos and doing exactly as the professor says then it looks like the instructor forgot to add these curly braces {} while coding.
Hope this helps
@ebbie Thank you so much! It worked :)
Thank you so much,its working.
On Wed, Sep 2, 2020, 12:42 Yaprak BULUT notifications@github.com wrote:
@RITESHKUMAR10 https://github.com/RITESHKUMAR10 @amabirbd https://github.com/amabirbd @yaprakbulut https://github.com/yaprakbulut I think I found my solution too. In /components/Cart.js,
I missed adding {} around removeFromCart
Previously it was, export default connect((state) => ({ cartItems: state.cart.cartItems, }), removeFromCart )(Cart);
and I changed the above code to
export default connect((state) => ({ cartItems: state.cart.cartItems, }), {removeFromCart} // This is where I forgot to add the {} )(Cart);
@amabirbd https://github.com/amabirbd I agree with you. Looks like only if we are missing something in the connected files, we are getting this error.
PS: If you are following udemy course videos and doing exactly as the professor says then it looks like the instructor forgot to add these curly braces {} while coding.
Hope this helps
@ebbie https://github.com/ebbie Thank you so much! It worked :)
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/basir/react-shopping-cart/issues/17#issuecomment-685401267, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKLIWR5JS62T43RAWGCZDSDSDXV5TANCNFSM4QADDYHA .
@ebbie that's probably it. Are you taking the udemy course?
@amabirbd Yes, I completed it yesterday and the course was really good.
Hii Sir, I am facing an error like getState is not a function in removeFromCart but in addToCart is working perfectly. Please resolve this error .