Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Simple ecommerce with add to cart

@fsp3012

Desktop design screenshot for the E-commerce product page coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
3intermediate
View challenge

Design comparison


SolutionDesign

Solution retrospective


I'm unable to show the cart count, if you know a simple way to do it, please comment below

Community feedback

@azick99

Posted

Well-done Fakorede, I like you project!

Here is some advice:

1.In your case it's not hard to make cart count pass count to Navbar through props and create ternary count === 0 ? " " : <span className='cart-count'> {count}</span> and style with position: absolute.

2.To make setCount(count - 1) is not correct because it goes minus like -1, -2 and so on, in order to prevent it use condition in onClick like: if (count > 0) { setCount(count - 1); }.

3.Pay attention to the styles try to make them better as in challenge.

I hope it will be useful for you. Keep coding!!!

Marked as helpful

0

Please log in to post a comment

Log in with GitHub
Discord logo

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord