What is the right way to locally store data?

Hey, everyone! I’m brand new to expo. Can you give me an advice on how to store my app’s data (like todo information or text notes) locally?

Hi and welcome! Currently we recommend using AsyncStorage, which is a key-value store. AsyncStorage is provided by React Native, these are the docs: 🚧 AsyncStorage · React Native. We’ve found AsyncStorage goes a long way and works really well for storing small bits of data like the current user’s login token.

We’re also looking at other storage APIs like SQL for when you want to store a lot of data of the same format and need indexes. Databases like Noms (GitHub - attic-labs/noms: The versioned, forkable, syncable database) are also interesting to me and there’s a JS implementation too, which is awesome. If they worked well on mobile and with Expo’s architecture we’d be open to providing the primitives to support Noms.

4 Likes

Awesome, thank you!

Oh, wow, I really love your project. As a web developer, I can finally just start making mobile apps. So cool. Keep it up, best of luck to your team!

2 Likes

Hi @ide, I noticed you have two APIs:

Is there a reason why you explicitly recommend AsyncStorage and Noms instead of those in Expo SDK? Thank you.

Update: I noticed that AsyncStorage is React Native built-in, so it’s a given. But I’m still curious why didn’t mention SecureStore as it’s very related to AsyncStorage.

Update 2: Noms no longer have JavaScript support, it’s pure Go now.

We don’t recommend Noms, just that you could look at it.

SecureStorage is a new API for storing a small amount of encrypted data. It’s a key-value API and has some special characteristics that the native layers give us (see Apple and Google’s API docs for specifics).

SQLite is for storing data that you want to query with a SQLite API.

1 Like