[DAY 75-77] I built a timer app using React
Tags: learning, react, javascript, buildinpublic
Published: 2024-07-16 13:21:08

Hi everyone! Welcome back to another blog where I document the things I learned in web development. I do this because it helps retain the information and concepts as it is some sort of an active recall.

On days 75-77, after finalizing the design of the clock timer app using CSS, I started to program the app by adding functionalities to its buttons and display.

In this blog, I'll show you how I finished building this app, how I deployed it to github and how I acquired my front end certificate.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1e9bihziilm8ygot1kkv.gif)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qb4v8hjkam3tq8se4ed7.PNG)

What I did first is to make a function to increment and decrement the break and session states. Adding 1 minute for every click.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/56h1b55upxe3cvcq0sjs.PNG)

I also added a function to handle the start, stop, and reset buttons.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1damewrup7gbtfnqqdjh.PNG)

Next, I created a useEffect hook to handle the countdown timer, as well as the loop between session and break states. The code goes like this: if the timer's state is running, the countdown plays and loops through the session and break states after the time runs out. If the timer’s state is not running, the clock pauses. I also returned a clearInterval at the end so that the state of the timer will always be refreshed whenever the hook runs.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xhfqt94a8cykfkyh81d3.PNG)

The clock will keep on cycling back and forth to 2 states which are the session state and the break state.

For example, I set a 3 minute-session and a 1-minute break. Once the session minutes run out, it will automatically switch its state to break and run a 1 minute timer. After it turns 0, it will automatically switch its state to session and run a 3 minute timer. This will keep on looping until the user presses the stop or reset button.

I personally use this app in my study sessions. I set 30 mins of session time to study and 5 mins for break. It's my pomodoro method of studying.

This app can also be used when working out. Set a 5-min timer for cardio and a 1-min timer for breaks.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q6awebrzl3e5pptnvkaz.PNG)

Finally, with this project finished, I earned my certificate in front end from freecodecamp and I can say that I am satisfied and happy with my progress considering I've been doing this after my 9-5. I learned so much in the span of 3 months and I am only getting started.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fvp5xio50oiz1iupms9k.PNG)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9ta23nyk07fw0w2xfsx4.png)

Now, I look forward to studying the back end part of the full stack roadmap as well as the database and APIs.

Anyways, that’s all for now, more updates in my next blog! See you there!