아래 코드 실행 중,
JSON.stringyfy(device)
에서if (device.id === targetDeviceID) { this.#bleManager.stopDeviceScan(); console.log('scan stopped'); AsyncStorage.setItem('ADTF-G1', JSON.stringify(device)); }
아래와 같은 오류 발생!
JavaScript 값이나 객체를 JSON 문자열로 변환하고, 선택적으로, replacer를 함수로 전달할 경우 변환 전 값을 변형할 수 있고, 배열로 전달할 경우 지정한 속성만 결과에 포함
var mycar ={}
mycar.a = mycar
JSON.stringify(mycar)
flatted라는 라이브러리를 통해 해결!
https://www.npmjs.com/package/flatted
https://www.educative.io/edpresso/what-is-typeerror-converting-circular-structure-to-json