@rnhooks/async-storage

0.0.2 • Public • Published

@rnhooks/async-storage Build Status Maintainability module formats: umd, cjs, esm

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

Name Type Default Description
key String null Async Storage Key

Output

Name Type Default Description
storageItem String null Async Storage Item
updateStorageItem function () => {} Async Storage updater method
clearStorageItem function () => {} Async Storage clear item method

Contribution

Questions

Feel free to contact me or create an issue

Package Sidebar

Install

npm i @rnhooks/async-storage

Weekly Downloads

18

Version

0.0.2

License

MIT

Unpacked Size

21.8 kB

Total Files

13

Last publish

Collaborators

  • pritishvaidya
  • divyanshu013