SMALL
useEffect(() => {
axios
.get(`http://localhost:4000/settingitems?Name=EOperator`)
.then((response) => {
let data = response.data[0].Value;
data = data.replaceAll("`", '"');
let parsedValue = JSON.parse(data);
setAttached(parsedValue?.Attached);
setPosition(parsedValue?.Position);
setName(parsedValue?.Name);
setPhone(parsedValue?.Phone);
changeActorInfo(parsedValue);
});
}, []);
정보를 가져왔을 때 `(백틱)부분을 " <-로 바꾼 후에 parse를 해줘야 적용이 되더라.
LIST
'일반' 카테고리의 다른 글
2022.11.29 TODO (0) | 2022.11.29 |
---|---|
MQTT (0) | 2022.11.29 |
React - iterable object error (0) | 2022.11.27 |
Html tag- data-set (0) | 2022.11.27 |
Body-parser (0) | 2022.11.22 |