-
[React-Native] SecureStore (Expo) 사용법코딩/React-Native 2021. 12. 26. 19:19
이전 포스팅에서 localstorage의 대안으로 AsyncStorage를 사용하려다 실패했습니다... 이에 expo에서 추천하는 SecureStore를 사용해보도록하겠습니다.
https://docs.expo.dev/versions/latest/sdk/securestore/
SecureStore - Expo Documentation
Expo is an open-source platform for making universal native apps for Android, iOS, and the web with JavaScript and React.
docs.expo.dev
위 도큐먼트를 참고했습니다! 코드를 제가 사용하기 편하도록 조금 수정해서 작성해봤습니다.
import * as SecureStore from "expo-secure-store"; export async function save(key, value) { return await SecureStore.setItemAsync(key, value); } export async function getValueFor(key) { return await SecureStore.getItemAsync(key); }끝내, 성공했습니다. 앞으로 AsyncStorage쓸 일 있으면 Secure Store를 사용하도록 합시다!
'코딩 > React-Native' 카테고리의 다른 글
[React-Native] Asyncstorage 사용법 - Not working (0) 2021.12.26