-
localStorage에서 불러올 때 생긴 오류
👻 : Unexpected token u in JSON at position 0 Error in JS
해결 방법
The "Unexpected token u in JSON at position 0" error occurs when we pass an undefined value to the JSON.parse or $.parseJSON methods. To solve the error inspect the value you're trying to parse and make sure it's a valid JSON string before parsing it.
JSON.parse(undefined)인 경우 나오는 에러로 데이터가 없을 때는 받아오지 않도록 추가 로직 작성 필요!
출처 : Fix - Unexpected token u in JSON at position 0 Error in JS
'Error' 카테고리의 다른 글
MacBook 에러 모음 (0) 2022.08.08 yarn : Could not resolve dependency... (0) 2022.04.11 리액트 타입스크립트 에러 : IntrinsicAttributes 오류에 대하여 (0) 2022.03.24 config: import ReactDOM from 'react-dom'이 안될 때 (0) 2022.03.24 yarn : 이 시스템에서 스크립트를 실행할 수 없으므로... (0) 2022.03.12 댓글