# All files / src/chap08 WeatherPage.js

0% Statements 0/2
100% Branches 0/0
0% Functions 0/1
0% Lines 0/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13

     import { useLoaderData } from 'react-router-dom';

    export default function WeatherPage() {
      // 로더를 통해 획득한 데이터를 가져온다.
      const data =  useLoaderData();
      return (
        <figure>
          <img src={`https://openweathermap.org/img/wn/${data?.weather?.[0]?.icon}.png`}
            alt={data?.weather?.[0]?.main} />
          <figcaption>{data?.weather?.[0]?.description}</figcaption>
        </figure>
      );
    }