일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- java_programming
- 백준 2512번
- SQL
- 머신러닝과 딥러닝
- 그래프
- 자바
- 다이나믹 프로그래밍
- 깃헙
- 백준 1987
- SWEA 15612번
- 그리디
- 백준 18310번
- MySQL
- 백준 16918번
- 명품자바
- ubuntu
- 알고리즘
- 백준 15787번
- 다이나믹프로그래밍
- react
- 백준
- AWS
- 백준 3085번
- 모각코
- 백준 17451번
- 백준 1253번
- HUFS 모각코 캠프
- Python
- 백준 1331번
- javascript
Archives
- Today
- Total
차곡차곡
[React/Error] axios.get 에러 TypeError: Cannot read properties of undefined (reading 'get') 본문
Web programming/React
[React/Error] axios.get 에러 TypeError: Cannot read properties of undefined (reading 'get')
sohy 2022. 7. 20. 21:25문제 상황
axios.get 으로 데이터를 받아오는 과정에서 계속해서 타입 에러가 났다.
TypeError: Cannot read properties of undefined (reading 'get')
해결 방법
상단에 axios를 import 해주는 코드가 잘못됐었다. 자동 완성 되는 대로 냅뒀더니
import { axios } from "axios";
이렇게 작성 돼 있었는데, 괄호가 없어야 한다!
import axios from "axios";
수정했더니 잘 돌아간다.
'Web programming > React' 카테고리의 다른 글
[React] 부트스트랩 적용하기 (2) | 2022.08.04 |
---|---|
[React/Error] API 에러 (Request failed with status code 429) (4) | 2022.07.20 |
[React] #10 외부 API를 연동하여 뉴스 뷰어 만들기 (0) | 2022.07.20 |
[React] #9 리액트 라우터로 SPA 개발하기 (0) | 2022.07.17 |
[React/실습] 투두리스트 제작 #4 (2) | 2022.07.14 |
Comments