소개
게시글
질문&답변
2021.07.11
useHistory를 이용한 push에서 typeError가 납니다ㅠㅠ
아래와 같이 뜹니다! url이 http://localhost:3000/upload 이렇게 바뀌는데 이동이 안되어서 새로고침을 해야 upload 화면이 켜지네요ㅠㅠ [HMR] Waiting for update signal from WDS... webpackHotDevClient.js:138 src\App.js Line 24:13: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images jsx-a11y/alt-text src\main\index.js Line 43:17: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images jsx-a11y/alt-text Line 61:19: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images jsx-a11y/alt-text Line 71:23: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images jsx-a11y/alt-text src\product\index.js Line 26:6: React Hook useEffect has a missing dependency: 'getProduct'. Either include it or remove the dependency array react-hooks/exhaustive-deps Line 47:9: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images jsx-a11y/alt-text Line 50:9: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images jsx-a11y/alt-text src\upload\index.js Line 63:15: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images jsx-a11y/alt-text Line 66:17: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images jsx-a11y/alt-text printWarnings @ webpackHotDevClient.js:138 index.js:1 Warning: Each child in a list should have a unique "key" prop. Check the render method of `MainPage`. See https://reactjs.org/link/warning-keys for more information. at div at MainPage (http://localhost:3000/static/js/main.chunk.js:893:80) at Route (http://localhost:3000/static/js/vendors~main.chunk.js:185431:29) at Switch (http://localhost:3000/static/js/vendors~main.chunk.js:185633:29) at div at Router (http://localhost:3000/static/js/vendors~main.chunk.js:185066:30) at BrowserRouter (http://localhost:3000/static/js/vendors~main.chunk.js:184686:35) at App (http://localhost:3000/static/js/main.chunk.js:248:86) at Router (http://localhost:3000/static/js/vendors~main.chunk.js:185066:30) at BrowserRouter (http://localhost:3000/static/js/vendors~main.chunk.js:184686:35)
- 1
- 3
- 257
질문&답변
2021.07.08
useHistory를 이용한 push에서 typeError가 납니다ㅠㅠ
여기 있습니다~ import { Form, Divider, Input, InputNumber, Button } from "antd"; import "./index.css"; function UploadPage() { const onSubmit = (values) => { console.log(values); }; return ( 상품 사진} > (사진) 이미지를 업로드 해주세요. 판매자 명} name="seller" rules={[{ required: true, message: "판매자 이름을 입력해주세요." }]} > 상품 이름} rules={[{ required: true, message: "상품 이름을 입력해주세요." }]} > 상품 가격} rules={[{ required: true, message: "상품 가격을 입력해주세요." }]} > 상품 소개} rules={[{ required: true, message: "상품 소개를 입력해주세요" }]} > 문제 등록하기 ); } export default UploadPage; import { useParams } from "react-router-dom"; import axios from "axios"; import { useEffect, useState } from "react"; import "./index.css"; function ProductPage() { const [product, setProduct] = useState(null); const { id } = useParams(); useEffect(function () { axios .get( `https://c2e78e79-909f-425e-9419-cef6efbaefa3.mock.pstmn.io/products/${id}` ) .then(function (result) { setProduct(result.data); }) .catch(function (error) { console.error(error); }); }, []); if (product === null) { return 상품정보를 받고 있습니다...; } return ( (사진) (사진) {product.seller} {product.name} {product.price}원 2020년 7월 7일 {product.description} ); } export default ProductPage; import { useParams } from "react-router-dom"; import axios from "axios"; import { useEffect, useState } from "react"; import "./index.css"; function ProductPage() { const [product, setProduct] = useState(null); const { id } = useParams(); useEffect(function () { axios .get( `https://c2e78e79-909f-425e-9419-cef6efbaefa3.mock.pstmn.io/products/${id}` ) .then(function (result) { setProduct(result.data); }) .catch(function (error) { console.error(error); }); }, []); if (product === null) { return 상품정보를 받고 있습니다...; } return ( (사진) (사진) {product.seller} {product.name} {product.price}원 2020년 7월 7일 {product.description} ); } export default ProductPage;
- 1
- 3
- 257