0% completed
Follow the instructions below to complete the challenge:
Create a CounterContext
:
Set up a context to manage the global counter state.
Implement a CounterProvider
:
Create a CounterProvider
component that stores and updates the counter state.
Create two buttons: Implement one button to increment the counter and another to decrement it.
Display the current counter value: Render the current counter value in a separate component.
Use useContext
to manage state:
Use useContext
in various components to access and update the counter state.
Follow the instructions below to complete the challenge:
Create a TodoContext
:
Set up a context to manage the global state of the todo list.
Use useReducer
for state management:
Use useReducer
to handle actions like adding, removing, and toggling todos in the list.
Implement a TodoProvider
:
Create a TodoProvider
component that wraps the app and provides state management via TodoContext
.
Create an input field: Implement a form or input field where users can add new todos to the list.
Display the todo list: Render the list of todos with each item having a "Complete" button (to mark a todo as done) and a "Delete" button (to remove a todo).
Use useContext
to manage state:
Use useContext
in various components to access and update the todo list.
.....
.....
.....