카테고리 없음
[ReactJS] 오류해결 Uncaught (in promise) TypeError: fetch(...).json is not a function
mswait
2022. 3. 18. 22:45
현상
동적 URL 로 ID 값을 가지고 들어갔을때 이를 통해 API 에 다시 request를 보내 데이터를 받아서 json 형식으로 처리를 해줘야 하는데 안되었다.
환장할 노릇이었다.
오류 메세지
Detail.js:8 Uncaught (in promise) TypeError: fetch(...).json is not a function
해결
await 함수에 한번 넣어주면 되었다.
바로 안되고 받은 걸 한번더 await 함수로 묶어서 .json() 해줘야 되는 것이었다.
참고 :
Request using fetch returns "typeerror: response.json is not a function" (ReactJS/node;express0
I'm developing a webpage with reactjs and a simple REST api/database with nodejs and I'm trying to properly use this API of mine from the front end. It was supposed to send a json containing {usern...
stackoverflow.com