If you are reading my blogs since I started 100 days of React, then you probably have a good idea of my schedule. I learn React during the day and blog about it at night. But today’s different. Today, I have started writing at 2 PM. Why!? 🤔
Fast and Furious Presents: Hobbs & Shaw was released yesterday. A friend of mine managed to get a hold of 5 free passes to its IMAX screening. There is going to be a small premiere first at 7 PM, and then the movie will start at 8 PM. That’s why I have cut my day short. I need to do a few other things before I go there!! 😎
👨💻 Decrement Button
In terms of learning, I didn’t do anything. There are some other things on my hotlist which needs to be done before I go to the premiere. When I first started 100 days of React initiative, I decided not to skip a single day. With this in mind, I thought if not learning, then I should experiment with React. So I added a small functionality in my Counter app.
My counter app had an increment button, but its decrement button was missing. I wrote the button’s code, which took me less than half an hour. And there I had it — a nice decrement button in my application. 🥂
When the decrement button is pressed, and the value is zero, it still decrements the number. So to prevent that, I added a small condition in my logic. This condition restricts the number from being decremented if it’s zero.