Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. import React from 'react';
  2.  
  3. const fruits = [{ name: 'Banana' }, { name: 'Strawberry' }, { name: 'Grape' }];
  4.  
  5. function App() {
  6. const renderList = () =>
  7. fruits.map(fruit => (
  8. <li>
  9. {/* custom 'tooltip-item' attribute */}
  10. <span tooltip-item={fruit.name} className='fruit-label'>
  11. {fruit.name}
  12. </span>
  13. </li>
  14. ));
  15.  
  16. return (
  17. <div className='container'>
  18. <ul className='fruits-list'>{renderList()}</ul>
  19. </div>
  20. );
  21. }
  22.  
  23. export default App;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement