1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 2x 6x 8x 6x | import React from 'react'; const GreetingMaster = (props) => { const {greetings, onAdd} = props; const body = greetings.map(greeting => <tr key={greeting.id}><td>{greeting.name}</td><td>{greeting.greeting}</td></tr>); return ( <div> <table> <thead> <tr><th>Name</th><th>Greeting</th></tr> </thead> <tbody> {body} </tbody> </table> <button onClick={onAdd}> Add </button> </div> ); }; export default GreetingMaster; |