Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. # loading
  2. import React, { useState } from "react";
  3. import { people } from "./people";
  4. export const Loading = () => {
  5. const loadMore = () => {
  6. setNumberOfPeople(val => val + 5);
  7. };
  8. const [numberOfPeople, setNumberOfPeople] = useState(5);
  9. return (
  10. <div>
  11. {people
  12. .slice(0, numberOfPeople)
  13. .map(({ name, email, city, mac, timestamp, creditcard }) => (
  14. <ul>
  15. <ul>
  16. <li>{name}</li>
  17. <li>{email}</li>
  18. <li>{city}</li>
  19. <li>{mac}</li>
  20. <li>{timestamp}</li>
  21. <li>{creditcard}</li>
  22. </ul>
  23. </ul>
  24. ))}
  25. <button onClick={loadMore}>we</button>
  26. </div>
  27. );
  28. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement