als62137540
@als62137540
Reviews Written
1
Average Rating
5.0
Posts
Q&A
์์ธํ์ด์ง์์ get์ด ์๋๋ ๊ฒฝ์ฐ
getํ์์ผ๋ก ๋ฐ์์จ๋ค๋ ๊ฑธ ๋ฐฉ๊ธ ์บ์นํด์ ํฌ์คํธ๋งจ์ผ๋ก ๋ฐ์ดํฐ๋ฅผ ์์ฒญํ๋๋ฐ ๋ฐ์ดํฐ๋ ์ ๋ฐ์์ง๋๋น.. (์ฌ์ง)
- 1
- 4
- 698
Q&A
์์ธํ์ด์ง์์ get์ด ์๋๋ ๊ฒฝ์ฐ
(์ฌ์ง) localhost: 8080 / products / 3 ์์ ์ด๋ฐ ๋ฐ์ดํฐ๋ค์ด ๋ณด์ด๋๋ฐ react๋ฅผ ์คํ์์ผ์ localhost: 3000 / products / 3 ์ ์ ์ํ๋ฉด 404์๋ฌ๊ฐ ๋จ๋๋ฐ ์๊ทธ๋ด๊น์... import { useParams } from "react-router-dom"; import axios from "axios"; import { useEffect, useState } from "react"; import "./index.css" function ProductPage() { const { id } = useParams(); const [product, setProduct] = useState(null); useEffect(function () { axios.get(`http:/localhost:8080/products/${id}`).then( function (result) { setProduct(result.data.product); console.log(result); } ).catch( function (error) { console.log(error); } ) }, [id]); if (product === null) { return h1>๊ฐ์ ๋ฐ์์ค๋ ์ค์ ๋๋ค...h1> } return ( div> div id="image-box"> img src={"/" + product.imageUrl} alt="product-img" /> div> div id="profile-box"> img src="/images/icons/avatar.png" alt="seller-img" /> span>{product.seller}span> div> div id="contents-box"> div id="name">{product.name}div> div id="price">${product.price}div> div id="create-at">์์ฑ๋ ๋ ์ง๊ฐ ๋ค์ด๊ฐ์์ : 2020.1.1.div> div id="discription">{product.discription}div> div> div> ); } export default ProductPage; (์ฌ์ง)
- 1
- 4
- 698
Q&A
์์ธํ์ด์ง์์ get์ด ์๋๋ ๊ฒฝ์ฐ
(์ฌ์ง)์ฝ์์ฐฝ์์๋ ํ๋กํ ์ฝ์๋ฌ๋ผ๊ณ ๋จ๋๋ฐ ์ด๋๋ถ๋ถ์ ๋ฌธ์ ์ธ์ง ๋ชจ๋ฅด๊ฒ ์ต๋๋ค...
- 1
- 4
- 698
Q&A
mock์๋ฒ error
์ฐธ๊ณ ๋ก ์ ์๋๊ป์ private์๋ฒ๋ฅผ ์ฐ์ จ๊ธธ๋ ์์ ๋ง๋ค๋ ์ฐธ๊ณ ํ๋ค๊ฐ ๊ตฌ๊ธ์์ private์๋ฒ ์ฌ์ฉ์ NotFoundError๊ฐ ๋ ์ ์๋ค๊ณ ํ์ฌ ๊ธฐ์กด์๋ฒ๋ฅผ ์ญ์ ํ๊ณ ๋ค์ mockServer๋ฅผ ์์ฑํ๋๋ฐ๋ NotFoundError๊ฐ ๋๋ค์.
- 1
- 2
- 834




