yogeshtakeo / BFS33_files

0 stars 0 forks source link

Task 3a: useState #3

Open yogeshtakeo opened 1 year ago

yogeshtakeo commented 1 year ago

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

  1. Create a new React component named Counter.

useState Hook

  1. Define a functional component named Counter that takes a single prop named count.

  2. Inside the Counter component, use the useState hook to create a state variable named currentCount and initialize it with the value of the count prop.

Displaying the Count

  1. Display the current count value in the component's JSX.

Increment and Decrement Functionality

  1. Add a button labeled "Increment" that, when clicked, increases the count by 1.

  2. Add a button labeled "Decrement" that, when clicked, decreases the count by 1.

Updating the Display

  1. Update the component's JSX to display the updated count value whenever it changes due to an increment or decrement.

Styling

  1. Customize the styling of the component and buttons using CSS or a CSS-in-JS solution of your choice.

Testing

  1. Test the Counter component by rendering it multiple times with different initial count values and verifying that the increment and decrement buttons work correctly.

Additional Requirements

  1. The count prop passed to the Counter component should be a number.

  2. The Counter component should not allow the count to go below zero.

Git and GitHub

  1. Create a new GitHub repository for this exercise.

  2. Push your project to the GitHub repository.

  3. Take screenshots of the code in your Counter.js file and the rendered component.

  4. Go to the GitHub repository's issues section and create a new issue.

  5. In the issue's comment section, upload the screenshots of your code and the rendered component.

  6. 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.

onsever commented 1 year ago

Onurcan Sever Github Link: https://github.com/onsever/js-concept-3a

Code Screenshot:

Image

Output Screenshot:

Image

GM-Frost commented 1 year ago

Nayan Task : UseState Git: https://github.com/GM-Frost/UseStateCounter.git

Image

bjornbaniya commented 1 year ago

Bjorn baniya

https://github.com/bjornbaniya/counter.git Image

Image

RoneshSingh commented 1 year ago

Annish

Repo: https://github.com/RoneshSingh/js-3a

Image

Image

shreeshakhadka commented 1 year ago

shreesha khadka task 3a https://github.com/shreeshakhadka/USESTATE3

Image Image

swskasingh commented 1 year ago

swastika singh task 3a

Image

Image

swskasingh commented 1 year ago

swastika singh github link https://github.com/swskasingh/counter.js.git

ngawangsherpa commented 1 year ago

Ngawang Sherpa Task 3a Github Link: https://github.com/ngawangsherpa/useState

Image

Image

poudelg25 commented 1 year ago

Gopal Poudel

Screenshot 2023-07-06 at 2 56 32 PM
YashKharel19 commented 1 year ago

YASH KHAREL Task 3a: useState github: https://github.com/YashKharel19/useState

counterjs countercss use state output