doc: add getBasketTotal method
This commit is contained in:
@@ -2,6 +2,9 @@ export const initialState = {
|
||||
basket: [],
|
||||
};
|
||||
|
||||
export const getBasketTotal = (basket) =>
|
||||
basket?.reduce((amount, item) => item.price + amount, 0);
|
||||
|
||||
const reducer = (state, action) => {
|
||||
switch (action.type) {
|
||||
case "ADD_TO_BASKET":
|
||||
|
||||
Reference in New Issue
Block a user