import React from "react"; import "./Display.css"; const getSummary = (items) => { let totalRawPrice = 0; let totalQuantity = 0; for (let i = 0; i < items.length; i++) { totalRawPrice += items[i].TotalPrice; totalQuantity += items[i].Quantity } return ( { "TotalRawPrice": totalRawPrice, "TotalQuantity": totalQuantity } ); } export const SummaryDisplayTR = (props) => { const summary = getSummary(props.items); return ( Total {summary.TotalQuantity} {summary.TotalRawPrice} ); } const SummaryDisplay = (props) => { const summary = getSummary(props.items); return (

Total: {summary.TotalRawPrice}

); } export default SummaryDisplay;