Fetch Data from API when sub component is expanded #2962
Unanswered
WeiTangLau
asked this question in
Q&A
Replies: 2 comments
-
Facing the same problem too. I referred to the SubComponent with lazy (https://codesandbox.io/s/github/tannerlinsley/react-table/tree/master/examples/sub-components-lazy). In my SubRowAsync function,
When I expand row 1, API is fetched, data is returned, and the expanded subComponent is showed. Then I expand row 2, problem happens. The row 1 data is override with the row 2 data. How to sort this out? |
Beta Was this translation helpful? Give feedback.
0 replies
-
Facing the same issue, i want to load data from api on after expansion. Is there any way to do this? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Referring to this example, https://codesandbox.io/s/github/tannerlinsley/react-table/tree/master/examples/sub-components?file=/src/App.js
when the sub component is expanded, the renderRowSubComponent will be rendered. I will then fetch from API based on the row opened. However, I realised that the component keeps on re-render indefinitely. Any idea how I can mitigate this?
Beta Was this translation helpful? Give feedback.
All reactions