paragon
paragon copied to clipboard
[sanity check] `PropTypes.oneOfType([PropTypes.element, PropTypes.func])` replaced with `PropTypes.elementType`
Example component where issue is seen:
DataTable
supports a columns
prop that allows consumers to customize their table's column configuration. For each column, consumers may override the Cell
property within react-table
to customize the display and bring in custom UI elements / formatting.
Currently, the Cell
property accepts a prop type similar to PropTypes.oneOfType([PropTypes.element, PropTypes.func])
. However, this does not support passing an element type, i.e. just the component name.
<DataTable
columns={[
{
id: 'testColumn',
Cell: TestTableColumnCell,
},
]}
/>
where TestTableColumnCell
might be the following, for example:
function TestTableColumnCell({ row }) {
return `${row.original.firstName} ${row.original.lastName}`;
}
https://github.com/openedx/paragon/pull/2749
@PKulkoRaccoonGang please check other components for the same issue