TIL

22.08.02

무려 네 달만의 TIL. 개발 공부와 일상을 분리할지 말지 엄청 고민했는데. 안하는걸로!

각티슈6개 물티슈10개 여행티슈10개 충동구매한 일상.


대신 티스토리에는 좀 더 글과 생각. 성취와 앞으로 나아가야할 것에 집중하려고 한다
내가 성공할 것 같으면 기록하랬어. 그리고 난 소심한 관종이기 때문에
티스토리 좀 더 예쁘게 꾸며줘야겠다.... 언제..?

1. async/await 은 충분히 공부했다 생각했는데 안 쓰다보니 막히는 부분이 생겼음~ 다시 꼼꼼히 읽어볼 것.
https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Statements/async_function
2. Response 객체에 대한 내용을 읽어본 적 없다뉭.. 대충격
Response.bodyUsed Read only
Stores a boolean value that declares whether the body has been used in a response yet.
-> 신기했던 내용. 그래서 response.json()으로 한 번 읽으면 또 못 읽구나..
https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
https://developer.mozilla.org/en-US/docs/Web/API/Response/

 

Response.json() - Web APIs | MDN

The json() method of the Response interface takes a Response stream and reads it to completion. It returns a promise which resolves with the result of parsing the body text as JSON.

developer.mozilla.org

response 객체는 꼼꼼히 본 적이 없는 것 같다. 반성.
특히 .json() 은 response 객체의 body text를 읽어오는 프로미스를 리턴한다는 것을 기억하기.
Returns a promise that resolves with the result of parsing the response body text as JSON.
async 함수는 프로미스 반환을 한다. 명시적으로 프로미스를 안 써줘도 덮어줌.
따라서 json.stringfy로 감싸서 문자열로 return 해주면 에러남.!

const data = await fetchBandListbyKeyword(keyword);

 

'TIL' 카테고리의 다른 글

변수 이름은 매우 중요했다  (0) 2022.09.28
디바운싱과 데코레이터  (0) 2022.09.09
22.04.05  (0) 2022.04.06
22.03.30  (0) 2022.03.31
22.03.29  (0) 2022.03.31