0.0.2 • Published 3 years ago

@rnhooks/async-storage v0.0.2

Weekly downloads
22
License
MIT
Repository
github
Last release
3 years ago

@rnhooks/async-storage Build Status Maintainability

React Native hook for AsyncStorage

import useAsyncStorage from '@rnhooks/async-storage';

function App() {
  const [storageItem, updateStorageItem, clearStorageItem] = useAsyncStorage(
    key,
  );

  return (
    <View style={styles.container}>
      <Text style={styles.type}>{`Storage Value: ${storageItem}`}</Text>
      <Button
        title="Update Item"
        onPress={() => updateStorageItem('Test String')}
      />
      <Button title="Clear Item" onPress={() => clearStorageItem()} />
    </View>
  );
}

Input

NameTypeDefaultDescription
keyStringnullAsync Storage Key

Output

NameTypeDefaultDescription
storageItemStringnullAsync Storage Item
updateStorageItemfunction() => {}Async Storage updater method
clearStorageItemfunction() => {}Async Storage clear item method

Contribution

Questions

Feel free to contact me or create an issue