Advertisement
Guest User

Untitled

a guest
Dec 25th, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React from 'react';
  2.  
  3. // Expected records object structure
  4. // [
  5. //   {id: 1, name: "John"},
  6. //   {id: 2, name: "Josh"},
  7. //   {id: 3, name: "Jean"}
  8. // ];
  9.  
  10. function Table({records}) {
  11.   return (
  12.     <div>
  13.       <table>
  14.         <thead>
  15.           <tr>
  16.             <th>ID</th>
  17.             <th>Name</th>
  18.           </tr>
  19.         </thead>
  20.         <tbody>
  21.           {records.map(record =>
  22.             <tr key={record.id}>
  23.               <td>{record.id}</td>
  24.               <td>{record.name}</td>
  25.             </tr>
  26.           )}
  27.         </tbody>
  28.       </table>
  29.     </div>
  30.   );
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement