Files
bigcapital/src/containers/FinancialStatements/ProfitLossSheet/hooks.js
2022-02-09 21:32:36 +02:00

20 lines
448 B
JavaScript

import React from 'react';
import { dynamicColumns } from './dynamicColumns';
import { useProfitLossSheetContext } from './ProfitLossProvider';
/**
* Retrieves the profit/loss table columns.
* @returns
*/
export const useProfitLossSheetColumns = () => {
const {
profitLossSheet: { table },
} = useProfitLossSheetContext();
return React.useMemo(
() => dynamicColumns(table.columns || [], table.rows || []),
[table],
);
};