React Advanced

0% completed

Previous
Next
Code Challenge

Challenge 1: Build a Theme Toggler

Follow the instructions below to complete the challenge:

  1. Create a CounterContext: Set up a context to manage the global counter state.

  2. Implement a CounterProvider: Create a CounterProvider component that stores and updates the counter state.

  3. Create two buttons: Implement one button to increment the counter and another to decrement it.

  4. Display the current counter value: Render the current counter value in a separate component.

  5. Use useContext to manage state: Use useContext in various components to access and update the counter state.

Challenge 2: Build a Todo List

Follow the instructions below to complete the challenge:

  1. Create a TodoContext: Set up a context to manage the global state of the todo list.

  2. Use useReducer for state management: Use useReducer to handle actions like adding, removing, and toggling todos in the list.

  3. Implement a TodoProvider: Create a TodoProvider component that wraps the app and provides state management via TodoContext.

  4. Create an input field: Implement a form or input field where users can add new todos to the list.

  5. 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).

  6. Use useContext to manage state: Use useContext in various components to access and update the todo list.

.....

.....

.....

Like the course? Get enrolled and start learning!
Previous
Next