I have a component that returns me a data that I want to display.
However I would like to add a conditional that would allow me to display my table only if it contains data.
We must use the if and else conditional for the display of the table.
Is there another solution to not display the map when it is empty?
import React from 'react';
import {Card, Col, Row } from 'react-bootstrap';
function Int(props: any) {
let calendarPlanned: any[] = props.calendarPlannedData;
return (
<Card>
<Card.Body>
{calendarPlanned.map((planned) => (
<Col xs={12} lg={12} className="no-gutters" key={planned.id}>
<Row>
<Col
xs={3}
lg={3}
className="no-gutters"
>
{planned.plannedDate}
</Col>
<Col
xs={2}
lg={2}
className="d-flex"
>
</Col>
<Col
xs={7}
lg={7}
className="d-flex"
>
<strong
className="d-block text-truncate"
>
{planned.stepName}
</strong>
</Col>
</Row>
</Col>
))}
</Card.Body>
</Card>
);
}
export default Int;