You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Are there best practices when it comes to storing app data locally? If possible, I'd prefer to store all of it in one JSON object under a key like AppData or something and just mutate this object and store it.
Details:
Is this an acceptable practice or should it be a series of individual key/values? Is there a max length allowed for the strings that can be stored under a single key? Will this be throttled at scale? I'd appreciate the insight form anyone who has tried this!
The text was updated successfully, but these errors were encountered:
Are there best practices when it comes to storing app data locally? If possible, I'd prefer to store all of it in one JSON object under a key like AppData or something and just mutate this object and store it.
Because we're talking about React Native (and the bridge between Native and JS world), it'd be best if you could split your data into smaller chunks. Each message has to be serialized into JSON before it reaches either end, so it's good practice to not clog it as much as possible.
Having a smaller pieces to work with always makes job simpler and more efficient. If your app uses only a small portion of that data in one feature and other portion in different feature, you don't want to manipulate whole data every time you do changes - just the piece that is used.
Is this an acceptable practice or should it be a series of individual key/values?
It depends of the use case. I generally try to group stored data into categories - if something is related to user, group that thing together. User has some activities? Store them as list of IDs, while activities is a separate piece of data stored.
Is there a max length allowed for the strings that can be stored under a single key?
@krizzu now that you mention converting all app data to/from JSON on every single storage request it makes sense that it would be more performant to break it into relative chunks. Thanks for the response!
You want to:
Are there best practices when it comes to storing app data locally? If possible, I'd prefer to store all of it in one JSON object under a key like
AppData
or something and just mutate this object and store it.Details:
Is this an acceptable practice or should it be a series of individual key/values? Is there a max length allowed for the strings that can be stored under a single key? Will this be throttled at scale? I'd appreciate the insight form anyone who has tried this!
The text was updated successfully, but these errors were encountered: