Advertisement
Guest User

Untitled

a guest
Jan 21st, 2020
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. import React from 'react';
  2. import s from './weather-styles.module.css';
  3. import get3DaysForecast from '../redux-weather-project/methods.js';
  4. import { Card, CardDeck } from 'react-bootstrap';
  5.  
  6. const
  7. const WeatherComponent = () => {
  8.  
  9. // let tepmMap = get3DaysForecast();
  10.  
  11. // let arrayTemp=Array.from(tepmMap.values()); //нужен await для асинхронного возврата данных [{} {} {}]
  12. ////////////////// Test ////////
  13. let getArrayTemp=async()=>{
  14. let arrayTemp=await get3DaysForecast();
  15. let arrayMap=Array.from(arrayTemp.values());
  16. return arrayMap;
  17.  
  18. }
  19. getArrayTemp()
  20. .then(resMap=>console.log(resMap))
  21. .catch(error=>console.log(error));
  22. // let mapCollection = new Map();
  23.  
  24. // for (let i = 1; i <= 3; i++) {
  25.  
  26. // mapCollection.set(i, { sum: 5, count: i })
  27.  
  28. // }
  29. // let numbers = Array.from(mapCollection.values())
  30.  
  31. const cardElements = (resMap.map((el) => {
  32. return (
  33. <Card className={s.Card}>
  34. <Card.Img variant="top" src="#" />
  35. <Card.Body className={s.CardBox}>
  36. <Card.Title>{el.count}</Card.Title>
  37. <Card.Text>{el.tempSum}</Card.Text>
  38. </Card.Body>
  39. </Card>
  40. )
  41.  
  42. }))
  43.  
  44. return (
  45. <div>
  46. <CardDeck className={s.CardContainer}>
  47. {cardElements}
  48. </CardDeck>
  49. </div>
  50. )
  51.  
  52. }
  53. export default WeatherComponent;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement