Skip to content

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

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published