Open yogeshtakeo opened 1 year ago
Onurcan Sever Github Link: https://github.com/onsever/js-concept-3a
Code Screenshot:
Output Screenshot:
Nayan Task : UseState Git: https://github.com/GM-Frost/UseStateCounter.git
Bjorn baniya
Annish
shreesha khadka task 3a https://github.com/shreeshakhadka/USESTATE3
swastika singh task 3a
swastika singh github link https://github.com/swskasingh/counter.js.git
Ngawang Sherpa Task 3a Github Link: https://github.com/ngawangsherpa/useState
Gopal Poudel
YASH KHAREL Task 3a: useState github: https://github.com/YashKharel19/useState
React useState and Props Exercise
Objective
The objective of this exercise is to assess the participants' understanding and proficiency in using the
useState
hook and working with component props in a React application.Component Setup
Counter
.useState Hook
Define a functional component named
Counter
that takes a single prop namedcount
.Inside the
Counter
component, use theuseState
hook to create a state variable namedcurrentCount
and initialize it with the value of thecount
prop.Displaying the Count
Increment and Decrement Functionality
Add a button labeled "Increment" that, when clicked, increases the count by 1.
Add a button labeled "Decrement" that, when clicked, decreases the count by 1.
Updating the Display
Styling
Testing
Counter
component by rendering it multiple times with different initial count values and verifying that the increment and decrement buttons work correctly.Additional Requirements
The
count
prop passed to theCounter
component should be a number.The
Counter
component should not allow the count to go below zero.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
Counter.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.