npm.io
1.0.42 • Published 2 years ago

reusable-cart-component

Licence
MIT
Version
1.0.42
Deps
1
Size
37 kB
Vulns
0
Weekly
0

Reusable-Cart-Component

This is a reusable cart component you can install to an e-commerce react application to display cart items. it includes all functionalities of a cart component:

  1. Viewing items added to cart
  2. Adding or reducing the quantity of an item
  3. Removing an item from the cart
  4. Clearing the cart.
  5. Displaying the total amount of all items in Ksh
  6. Displaying the amount per item based on the quantity

NPM JavaScript Style Guide

How to Install

npm install --save reusable-cart-component

Usage

  • In the jsx component you want to display the cart items you need to:
  1. Install the components in your main folder
  2. Ensure the component is visible in your package.json file
  3. Import the component as shown below
  4. Instantiate the component
  5. Provide the cart items (the items selected by a user from the main products page)
  6. The component will do the rest
import MyComponent from 'reusable-cart-component'
import 'reusable-cart-component/dist/index.css'


const Cart = () => {
  return (
    <div>
      <ReusableCartComponent items={items} cartId={cartId}  />  
    </div>
  )
}

export default Cart

Requirements

Node version >=10

License

MIT

Github

kristinenyaga

Reach out