Non Polar Magnetism

    TypeScript icon, indicating that this package has built-in type declarations

    2.0.0-beta1 • Public • Published


    Status GitHub Issues GitHub Pull Requests License

    Add state persisting to @huds0n/shared-state using @react-native-async-storage/async-storage

    📝 Table of Contents

    🧐 About

    Add state persisting to React Native projects using the @huds0n/shared-state module.

    List of Features

    • Quick: Initialize a store in a single line.
    • Secure: Built in AES encryption.
    • Specific: Use include/exclude keys to specify which props to save.
    • Automatic: Have state save on background or after change.

    🏁 Getting Started


    Requires huds0n/shared-state and @react-native-async-storage/async-storage.


    npm i @huds0n/shared-state-store-rn

    🧑‍💻 Usage

    Persist a Shared State

    import { SharedState } from "@huds0n/shared-state";
    const ExampleState = new SharedState({
      username: null,
      password: null

    Returns a promise that resolve with true/false depending on success.See reference for storeOptions.

    📖 Reference

    Store Options

    Prop Required/(Default) Description Type
    encryptionKey - AES encryption stringStorage unencrypted if undefined string
    excludeKeys - List of state props not to save array of state keys
    includeKeys - List of state props to saveAll other state props skippedOverrides excludeKeys prop array of state keys
    replacer - Replacer function used in stringifing the save state (key: string, value: any) => any
    reviver - Reviver function used in parse the save state (key: string, value: any) => any
    saveOnBackground false Saves state automatically when app is backgrounded boolean
    saveAutomatically false Saves state automatically whenever state changes boolean
    storeName name of store string

    ✍️ Authors

    See also the list of contributors who participated in this project.

    🎉 Acknowledgements

    • Special thanks to my fiance, Arma, who has been so patient with all my extra-curricular work.


    npm i @huds0n/shared-state-store-rn

    DownloadsWeekly Downloads






    Unpacked Size

    19.2 kB

    Total Files


    Last publish


    • jonti_hudson