๋ชจ๋ฐ์ผ ํ๊ฒฝ์์ ๊ฐ์ฅ ์์ธก ๋ถ๊ฐ๋ฅํ ์์ ์ค ํ๋๋ ๋คํธ์ํฌ ์ํ์
๋๋ค.
๋๋ฆฐ ์ฐ๊ฒฐ, ์คํ๋ผ์ธ ์ํ์์๋ ์ฑ์ด ์์ฐ์ค๋ฝ๊ฒ ์๋ํ๋ ค๋ฉด
์ ์ ํ UX ๋์ ์ ๋ต์ด ํ์ํฉ๋๋ค.
์ด๋ฒ ๊ธ์์๋ React Native ์ฑ์์ ๋คํธ์ํฌ ์ํ๋ฅผ ๊ณ ๋ คํ UX ๊ตฌํ๋ฒ์ ์ ๋ฆฌํด๋ด
๋๋ค.
@react-native-community/netinfo
์ฌ์ฉimport NetInfo from '@react-native-community/netinfo'
useEffect(() => {
const unsubscribe = NetInfo.addEventListener(state => {
console.log('Is connected?', state.isConnected);
});
return () => unsubscribe();
}, []);
{!isConnected && (
<View style={styles.banner}>
<Text>์ธํฐ๋ท ์ฐ๊ฒฐ์ด ์์ต๋๋ค.</Text>
</View>
)}
<ScrollView
refreshControl={
<RefreshControl
refreshing={refreshing}
onRefresh={refetch}
/>
}
/>
AsyncStorage
, MMKV
, react-query
, SWR
๋ฑ ์ฌ์ฉํ์ฌimport AsyncStorage from '@react-native-async-storage/async-storage'
await AsyncStorage.setItem('userData', JSON.stringify(data))
์ ๋ต | ํต์ฌ ํค์๋ |
---|---|
๋คํธ์ํฌ ๊ฐ์ง | NetInfo, isConnected |
์ฌ์ฉ์ ์๋ฆผ | ์คํ๋ผ์ธ ๋ฐฐ๋, alert |
์บ์ฑ ์ฒ๋ฆฌ | AsyncStorage, react-query |
์ฌ์๋ ์ ๋ต | SWR, ์๋ก๊ณ ์นจ |
์ฌ์ฉ์ ์ ๋ ฅ ๋ณด์กด | draft ์ ์ฅ |
์คํจ ์ฒ๋ฆฌ | ํ์, ์ ์ก ์ฌ์๋ |
โ๏ธ ๋คํธ์ํฌ ์ฅ์ ๋ ํผํ ์ ์์ง๋ง,
๊ทธ ๊ฒฝํ์ ์ผ๋ง๋ ๋ถ๋๋ฝ๊ฒ ๋ง๋ค ์ ์๋๋๊ฐ
์ฑ ์์ฑ๋์ ์ฐจ์ด์ ๋๋ค. ๐