Open yogeshtakeo opened 1 year ago
Bjorn Baniya https://github.com/bjornbaniya/Clock.git
Onurcan Sever Github Link: https://github.com/onsever/js-concept-4
Code Screenshot:
Output Screenshot:
shreesha khadka task 4 https://github.com/shreeshakhadka/Clock
Nayan Task: UseEffect Clock Git: https://github.com/GM-Frost/BFS33-Clock.git
swastika singh https://github.com/swskasingh/clock.js.git
YASH KHAREL TASK 4: CLOCK github: https://github.com/YashKharel19/clock
Ngawang Sherpa Task 4: Clock Github Link: https://github.com/ngawangsherpa/Clock
Gopal Poudel
Clock in JS
Objective
The objective of this exercise is to assess the participants' understanding and proficiency in using the
useEffect
hook in a React application.Task Description
You are tasked with creating a simple clock component that displays the current time and updates every second.
Instructions
Create a new React component named
Clock
.Inside the
Clock
component, import theuseEffect
anduseState
hooks from the React library.Use the
useState
hook to create a state variable namedcurrentTime
and initialize it with a default value of the current time.Display the
currentTime
value in the component's JSX.Use the
useEffect
hook to set up an interval that updates thecurrentTime
every second.Within the
useEffect
hook, create a cleanup function that clears the interval when the component is unmounted.Customize the styling of the component using CSS or a CSS-in-JS solution of your choice.
Test the
Clock
component by rendering it and verifying that it displays the current time and updates every second.Additional Requirements
currentTime
value should be formatted as a human-readable time, such as "HH:MM:SS".Git and GitHub
Create a new GitHub repository for this exercise.
Push your project to the GitHub repository.
Take screenshots of the code in your
Clock.js
file and the rendered component.Go to the GitHub repository's issues section and create a new issue.
In the issue's comment section, upload the screenshots of your code and the rendered component.
Include the GitHub repository URL in the comment as well.
Submission
Share the screenshots of your code and the rendered component in the issue's comment section of your GitHub repository. Make sure to include the GitHub repository URL in the comment.
Note: Feel free to use any additional JavaScript or CSS features or syntax to enhance your solution. Provide comments where necessary to explain your code.