Where is the proper place to transform data for a column of the table? #2284
-
Presently the data for our table is returned from an api, and included in the table as thus:
One of our columns contains a date value in a Timestamped format. We want to transform this timestamp into a humanized "x Days Ago" string. I'm curious where is the recommended place to do the data transformation? Should it be right from the start in the Something like:
or is there a more fitting / performant place to do this transformation? It is possible for additional data to be added to apiData via ajax. Thanks for any insight! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Just started using this package, but I would write a separate function to do that before you pass the data into For example: However, I have not been able to get data generated from such a function to work in |
Beta Was this translation helpful? Give feedback.
-
If this is something that is purely presentational and doesn't change the core data you are putting in to the table, you can use a custom Cell renderer for the column: columns = [{
accessor: 'updated_at',
Cell: ({ value }) => humanizeDaysAgo(value)
}] Dunzo! |
Beta Was this translation helpful? Give feedback.
If this is something that is purely presentational and doesn't change the core data you are putting in to the table, you can use a custom Cell renderer for the column:
Dunzo!