display sub array length as column value #3741
Answered
by
vasanthi-d
vasanthi-d
asked this question in
Q&A
-
Hi All, I am just getting started with react-table 7 and need some help with below question. I have my json object that looks like this.
In my table, I would like to display
How can access the length of courses array while defining columns data for react-table so appropriate count is displayed under "# of courses" column? |
Beta Was this translation helpful? Give feedback.
Answered by
vasanthi-d
Mar 1, 2022
Replies: 1 comment
-
nvm, I just had to use function for accessor. I wasn't aware that accessor can take functions. { |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
vasanthi-d
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nvm, I just had to use function for accessor. I wasn't aware that accessor can take functions.
{
Header: '# of course',
accessor: (row) => row.courses.length || 0
}