-
Hi all. I am trying to learn and understand how to use react-table. I followed the quick start guide and got the basic table to render correctly. I was able to reproduce the error on CodeSandbox here Any help would be appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hey @WheatiesTM I've fixed your error here - you still need a function for the Table so you can actually render it. I've also added useCallback to your method, so it won't trigger re-render. It is not needed currently as it is static array you are going to return, but I imagine you are going to need to get this data from API or redux state, thus useCallback is more than welcome. Let me know if you have any questions - I'll try to help you out. |
Beta Was this translation helpful? Give feedback.
-
Thank you for the help! The need for a function to render the table was not explicitly stated in the quick start guide (although maybe it was implied by the examples and I overlooked it). Again thank you for the help! Edit: I looked more carefully at your fix and I think it has to do with that the |
Beta Was this translation helpful? Give feedback.
Hey @WheatiesTM
I've fixed your error here - you still need a function for the Table so you can actually render it.
https://codesandbox.io/s/zen-goldstine-45966?file=/src/App.js
I've also added useCallback to your method, so it won't trigger re-render. It is not needed currently as it is static array you are going to return, but I imagine you are going to need to get this data from API or redux state, thus useCallback is more than welcome.
Let me know if you have any questions - I'll try to help you out.