Advertisement
Guest User

Untitled

a guest
Aug 25th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. import React, { useState } from "react";
  2.  
  3. //import any components needed
  4. import NumberButton from './NumberButton'
  5.  
  6. //Import your array data to from the provided data file
  7. import { numbers } from "../../../data"
  8.  
  9. const Numbers = () => {
  10. // STEP 2 - add the imported data to state
  11. const [numState, setNumState] = useState(numbers);
  12.  
  13. return (
  14. <div>
  15. {
  16. numState.map(x => {
  17. return (
  18. <NumberButton number={x} />);
  19. })
  20. }
  21. </div>
  22. );
  23. };
  24.  
  25. export default Numbers;
  26.  
  27.  
  28. //
  29.  
  30.  
  31. import React from "react";
  32. import styled from 'styled-components';
  33.  
  34. const NumberButton = props => {
  35. return (
  36. <>
  37. {/* Display a button element rendering the data being passed down from the parent container on props */
  38. <StyledButton>{props.number}</StyledButton>
  39. }
  40. </>
  41. );
  42. };
  43.  
  44. export default NumberButton;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement