I have a Table and I have Collapse component in each row. I want to add chevron to it and when I clicked it I want content to be appeared and chevron changes its shape. How can I do that in table ?
Ps: Is it possible to do that without defining state?
Here is an example
https://stackblitz.com/edit/reactstrap-uncontrolled-collapse-2qgsf6?file=index.js,index.html
You need to use a controlled
Collapseinstead of anUncontrolledCollapse.Also, your data should be in an array, and be mapped inside the
render()function.Finally, I would also avoid using a clunky
<table>element to structure your content. Go with a FlexBox or Gird layout.Note: If
this.state.toggleStates[index]istrue, this means that the.AccordianItemis expanded.Here is the modified StackBlitz: