I am trying to teach myself React using Kirupa’s book and videos. I followed along and created the ‘Dealing with State’ app and I am trying to modify it some. I have the counter counting down and what I would like to do is display a message when the counter hits zero, but I am unsure of what I need to do to achieve that. Hopefully, Kirupa or someone else can assist.
Here is what I have so far code wise. State.html (2.4 KB)
Hi webguynyc!
Sorry for the delay in replying. My post was saved as a draft but I forgot to submit it. There are several ways you can do that. One way is what you see below:
I modified the CountDown component to handle displaying the text as well. I am passing in the text styles as a prop from the CountDownDisplay component. That is probably unnecessary, but I did it just to show the flexibility you have
one more adjustment I would like to make is calling the timer function on a button click, so the timer starts when the button is clicked and stops when the button is clicked again.