john-smilga / react-vite-projects-14-cart

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Steps

Explore

Explore the current application and analyze its functionality.

Global Context and useReducer

Set up global context and immediately create a general setup for useReducer. Create two files, one for reducer and one for actions.

Map

In the default state, set cart not as an array but as a new Map().

Functionalities

Create the following functionalities:

Clear Cart - an action that clears the entire cart. Remove Item - an action that removes a specific item from the cart. Increase Amount - an action that increases the quantity of a specific item in the cart. Decrease Amount - an action that decreases the quantity of a specific item in the cart. Fetch Data - an action that fetches data from an API and stores it in the cart state. Calculate Totals - a function that calculates the total cost of items in the cart. Implement these functionalities in the reducer and actions files, and make them available in the global context.

Test

Test the functionality of the application and fix any issues that arise.

The flow of the application should look something like this:

  • Explore the current application and analyze its functionality.
  • Set up global context and immediately create a general setup for useReducer. - - Create two files, one for reducer and one for actions.
  • In the default state, set cart not as an array but as a new Map().
  • Create the following functionalities: Clear Cart, Remove Item, Increase Amount, Decrease Amount, Fetch Data, and Calculate Totals.
  • Implement these functionalities in the reducer and actions files, and make them available in the global context.
  • Test the functionality of the application and fix any issues that arise

About


Languages

Language:JavaScript 50.3%Language:CSS 47.4%Language:HTML 2.2%