강의

멘토링

커뮤니티

Cộng đồng Hỏi & Đáp của Inflearn

Hình ảnh hồ sơ của corini
corini

câu hỏi đã được viết

Một trại huấn luyện phát triển toàn diện thực sự dành cho những người không chuyên ngành

[그랩마켓] Phát triển web với React - 2

상품들이 안 뜹니다..

Viết

·

611

1

상품들이 안 뜹니다. 도와주세요ㅜㅜ
 
로그입니다.
 
58b072e3-fb91-49c6-bb15-bd60e78f0464.mock.pstmn.io/:1 Failed to load resource: the server responded with a status of 404 () index.js:1 에러 발생 : Error: Request failed with status code 404 at createError (createError.js:16) at settle (settle.js:17) at XMLHttpRequest.onloadend (xhr.js:66)
 
import "./index.css";
import axios from "axios";
import React from "react";

function MainPage() {
  const [products, setProducts] = React.useState([]);
  React.useEffect(function () {
    axios
      .get("https://58b072e3-fb91-49c6-bb15-bd60e78f0464.mock.pstmn.io")
      .then(function (result) {
        const proucts = 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;
머신러닝 배워볼래요? reacttensorflowHTML/CSSreact-nativejavascriptnodejsexpress

Câu trả lời 3

1

corini님의 프로필 이미지
corini
Người đặt câu hỏi

오타 때문이었습니다.. 해결했습니다. 강의 잘 듣고있습니다. 좋은 강의 감사드립니다!!

0

corini님의 프로필 이미지
corini
Người đặt câu hỏi

콘솔 에러입니다..

Uncaught (in promise) Error: Could not establish connection. Receiving end does not exist.

    at polyfill.js:129

0

corini님의 프로필 이미지
corini
Người đặt câu hỏi

목서버 부분 https://58b072e3-fb91-49c6-bb15-bd60e78f0464.mock.pstmn.io/products 로 바꿨는데도 안됩니다..ㅜ

Hình ảnh hồ sơ của corini
corini

câu hỏi đã được viết

Đặt câu hỏi