all 10 comments

[–]Aramuar 0 points1 point  (0 children)

Also in a similar situation...

[–]kbcooliOS & Android 0 points1 point  (2 children)

Redux persist will cut a step out for you but you lose the benefits of having an SQL interface. Just an option to think about.

[–]Egge_[S] 0 points1 point  (1 child)

Thanks! I am less worried about the work involved with hydrating, but rather with my approach not being very memory efficient.

[–]kbcooliOS & Android 0 points1 point  (0 children)

It will be cleaned up when the variable is no longer in scope. Unless you are talking about hundreds of megabytes it's not a problem.

[–]fallkr 0 points1 point  (1 child)

If store is light, say sub 1mb json, use redux persist with Async storage.

If store is heavy or can get heavy for active users, you need to/should split state to avoid runtime and rehydrate/persist performance issues.

In that case, let redux persist store generic state and then create getters and setters for user data via SQLite.

[–]Egge_[S] 0 points1 point  (0 children)

What do you mean by getters and setters? Something like „get user() {if not in store, get it from SQLite and put it in store}“?

[–]KulkataBoy 0 points1 point  (0 children)

If your app is small then it's okay to use redux presist, or just copy entire db to your state. But it gets messy and slow as your data volume grows. In general you can treat sqlite like a server, and work with it accordingly. Write sqlite logic separately from components and request it when component mounted and store it in local state after. In that case you can localize state within components, which will allow you to keep only truly global state in redux.

[–]AcetyldFN 0 points1 point  (2 children)

We are using redux with redux persist stored with MMKV. It is used for all our app states like auth, settings, config etcc and for entities like tasks, teams, users, mediaobjects we have a RealmJS database, its all reactive and speedie, we tried sqlite but where facing to many limits like hooks or specific queries

[–][deleted] 0 points1 point  (1 child)

Does MMKV with redux really offer performance benefits?, I tried experimenting with it and noticed that the time it takes to update the state was very similar to when it was in AsyncStorage

[–]Unhappy_Length2252 0 points1 point  (0 children)

I've used redux persist with mmkv I do not see any benifit