import React from 'react'
import { Table } from 'react-bootstrap';

const Plants = ({plants}) => {

  return (
      <>
        {
            plants.length !== 0 ?
            <Table striped bordered hover>
                <thead>
                    <tr>
                    <th>Plant name</th>
                    <th>Plant type</th>
                    </tr>
                </thead>
                <tbody>
                {
                    plants.map((plant, index) => {
                        return <tr key={index}>
                                    <td>{plant.name}</td>
                                    <td>{plant.type}</td>
                                </tr>
                    })
                }
                </tbody>
            </Table> : null
        }
      </> 
    );

}

export default Plants