인프런 영문 브랜드 로고
인프런 영문 브랜드 로고

Inflearn Community Q&A

­박상신(대학원/공학대학원 전기전자공학전공)'s profile image
­박상신(대학원/공학대학원 전기전자공학전공)

asked

A real introductory all-in-one development boot camp for non-majors

[Grab Market] Web Development with React - 2

상품들은 안보이고 다른건 잘 보입니다. 상품들은 왜 안나오는걸까요?? 이전 수업까진 다 나왔었습니다.

Written on

·

181

1

npm start 해서 터미널로 보면 아래와 같이 뜨고 코드도 맨 아래에 있습니다. 

Compiled with warnings.

src\main\index.js

  Line 24:11:  img elements must have an alt prop, either with meaningful text, or an empty string for decorative images  jsx-a11y/alt-text

  Line 29:11:  img elements must have an alt prop, either with meaningful text, or an empty string for decorative images  jsx-a11y/alt-text

  Line 37:19:  img elements must have an alt prop, either with meaningful text, or an empty string for decorative images  jsx-a11y/alt-text

  Line 43:21:  img elements must have an alt prop, either with meaningful text, or an empty string for decorative images  jsx-a11y/alt-text

Search for the keywords to learn more about each warning.

To ignore, add // eslint-disable-next-line to the line before.

코드는 아래와 같이 작성하였습니다.

import "./index.css";
import axios from "axios";
import React from "react";

function MainPage() {
  const [products, setProducts] = React.useState([]);
  React.useEffect(function () {
    axios
      .get(
        "https://f3cda4ca-2283-4a63-82c0-4a22dc3dac04.mock.pstmn.io/products"
      )
      .then(function (result) {
        const products = result.data.products;
        setProducts(products);
      })
      .catch(function (error) {
        console.error("에러 발생 : ", error);
      });
  }, []);
  return (
    <div>
      <div id="header">
        <div id="header-area">
          <img src="images/icons/logo.png" />
        </div>
      </div>
      <div id="body">
        <div id="banner">
          <img src="images/banners/banner1.png" />
        </div>
        <h1>판매되는 상품들</h1>
        <div id="product-list">
          {products.map(function (product, index) {
            return (
              <div className="product-card">
                <div>
                  <img className="product-img" src={product.imageUrl} />
                </div>
                <div className="product-contents">
                  <span className="product-name">{product.name}</span>
                  <span className="product-price">{product.price}</span>
                  <div className="product-seller">
                    <img
                      className="product-avatar"
                      src="images/icons/avatar.png"
                    />
                    <span>{product.seller}</span>
                  </div>
                </div>
              </div>
            );
          })}
        </div>
      </div>

      <div id="footer"></div>
    </div>
  );
}

export default MainPage;
react머신러닝 배워볼래요? react-nativenodejsexpresstensorflowjavascriptHTML/CSS

Answer 1

0

grab님의 프로필 이미지
grab
Instructor

안녕하세요! 현재 에러 내용을 확인해보니 포스트맨 Mock 서버에서 Status Code로 429인 에러를 보내고 있습니다.

포스트맨 Mock 서버는 무료 기능이나, 1분당 최대 60회라는 Call 제한이 있습니다. 이를 넘어서면 해당 에러를 내게 됩니다. 

이 문제는 시간이 지나면 다시 사용이 가능할 거예요!

­박상신(대학원/공학대학원 전기전자공학전공)'s profile image
­박상신(대학원/공학대학원 전기전자공학전공)

asked

Ask a question