I'm trying to render card from data and also binding this to the constructor but still, I'm getting this error on all the line where this
is used.
class SamplePage2 extends Component {
constructor() {
super()
this.state = { accordionKey: 0, data: [] }
}
render() {
const { accordionKey } = this.state;
return (
<Aux>
<Row>
<div className="card-height">
{this.state.data.map(function (item, key) {
return (
<Card className='Recent-Users' key={key}>
<Card.Body className='px-0 py-2'>
<Table responsive hover>
<tbody>
<tr className="unread" onClick={() => this.setState({ accordionKey: (accordionKey !== { key } + 1) ? { key } + 1 : 0 })} aria-controls="accordion1" aria-expanded={accordionKey === { key } + 1}>
<td>
<h6 className="mb-1">{item.appName}</h6>
</td>
<td>
<h6 className="mb-1">{item.appState}</h6>
</td>
</tr>
</tbody>
</Table>
<Collapse in={this.state.accordionKey === { key } + 1}>
<div id="accordion1">
<Card.Body>
<Card.Text>
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon official.
</Card.Text>
</Card.Body>
</div>
</Collapse>
</Card.Body>
</Card>
)
})}
</div>
</Row>
</Aux>
);
}
}
export default SamplePage2;