-
Having an uncontrolled accordion, I wish to do some data fetching whenever an item is expanded. const data = [] // fetched from server
return (
<Accordion>
{data.map((item, i) => (
<AccordionItem value={item.id}>
<AccordionControl>{item.name}</AccordionControl>
<AccordionPanel>
<CustomPanel data={item}/> // should do data fetching when expanded
</AccordionPanel>
</AccordionItem>
)})
</Accordion>
)
One workaround that came to my mind is to make the What approach do you recommend? I need this behavior in multiple places in the app |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Use controlled state, it is the correct solution |
Beta Was this translation helpful? Give feedback.
Use controlled state, it is the correct solution