Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. import React from 'react'
  2.  
  3. const TableHeader = () => {
  4. return (
  5. <thead>
  6. <tr>
  7. <th>Destination</th>
  8. <th>Country</th>
  9. </tr>
  10. </thead>
  11. )
  12. }
  13.  
  14. const TableBody = (props) => {
  15. const rows = props.destinations.map((row, index) => {
  16. return (
  17. <tr key={index}>
  18. <td>{row.destination}</td>
  19. <td>{row.country}</td>
  20. </tr>
  21. )
  22. })
  23. return (
  24. <tbody>{ rows }</tbody>
  25. )
  26. }
  27.  
  28. class Table extends React.Component {
  29. render() {
  30. const destProps = this.props.destinations
  31. return (
  32. <table>
  33. <TableHeader />
  34. <TableBody destinations = {destProps} />
  35. </table>
  36. )
  37. }
  38. }
  39.  
  40.  
  41. export default Table
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement