UNPKG

@appbuckets/react-ui

Version:
25 lines (22 loc) 617 B
import * as React from 'react'; function useCellElementContent(content, row, rowIndex, data) { // ---- // Return a Memoized Element // ---- return React.useMemo( function () { /** If no content builder exists, return null */ if (!content) { return null; } /** If content is a function, then return the result */ if (typeof content === 'function') { return content(row, rowIndex, data); } /** Else, return the original content */ return content; }, [content, rowIndex, data, row] ); } export { useCellElementContent as default };