import { usePools } from "../usePools/usePools"; import { useMemo } from "react"; export const useAggregatePoolData = () => { const { poolsArray } = usePools(); const data = useMemo( () => poolsArray.reduce( (acc, pool) => ({ totalInvested: (acc.totalInvested += pool.totalInvested), totalAllocationPoints: (acc.totalAllocationPoints += pool.allocationPoints), }), { totalInvested: 0, totalAllocationPoints: 0, } ), [poolsArray] ); return data; };