Overview
TherenderValue function is the default cell renderer that displays the value of row[column.key]. It safely renders cell values and handles errors gracefully.
Signature
Parameters
The cell renderer props.
RenderCellProps
The row object containing the cell data.
The column object, which includes the
key property used to access the cell value.The index of the row.
Whether the cell is editable.
The tab index for keyboard navigation.
Callback to update the row.
Return Value
The value from
row[column.key], or null if an error occurs while accessing the value.Usage
This is the default cell renderer used when no customrenderCell is specified. You can also use it explicitly:
Behavior
- Safely accesses
row[column.key] - Returns the value as
React.ReactNode(strings, numbers, elements, etc.) - Returns
nullif an error occurs (e.g., accessing undefined properties) - Supports any React-renderable value type
Example
The following examples demonstrate the default cell rendering:Custom Cell Renderers
For more complex cell rendering, create a custom renderer:Error Handling
The function uses a try-catch block to handle errors gracefully:- The column key doesn’t exist on the row object
- Accessing the property throws an error (e.g., getter with an error)
- The value cannot be converted to a ReactNode
Related
- Column.renderCell - Custom cell renderer configuration
- RenderCellProps - Cell renderer props type
- Cell component - Default cell component