useState Example

Task 1: Create a button that increments a count each time it is clicked. The count should be displayed above the button.

Live Demo

Count: 0

Implementation

CountClicked.tsx

Task 2: Create an input field that updates a state variable with the current value of the input. Display the current value below the input field.

Live Demo

Current input value:

Implementation

InputState.tsx

Task 3: Create a simple Todo List application where users can add, delete, and toggle the completion status of todos. Display the list of todos below the input field.

Live Demo

Todo List

    No todos yet. Add some!

    Implementation

    TodoList.tsx

    Task 4: Create a Like or Dislike component where users can click on a button to like or dislike an item. Display the current state of like or dislike below the buttons.

    Live Demo

    Like or Dislike

    Implementation

    LikeOrDislike.tsx