Relative Content

Tag Archive for htmlreactjsreact-hooksmaterial-ui

How to stop decrement by using function and useState in react JS

I created a card in reactJS for ecommerce app. Add to cart button and increment or decrement button also work here in same card. when I click increment button, they perform work accurately and increment number one by one. When I click decrement button, they could not perform task. I want, when I click decrement button, number decrements and stops on zero no negative value shown me.