How to store and update data in React Native

I have a database that changes its values constantly and I'm creating an app that displays that information using React Native.

My question is: how should I store that data in the application and how should I update that information every few seconds?

In the database I have a single table with a single record that I would have to download from time to time. I want to access that data from different screens.

I've seen Context and AsyncStorage to store the data and use it globally but I don't know which one is better or how to use it well.

Upvotes: 1

Views: 390

Answers (2)

RB RB
RB RB

Reputation: 166

You can also use MobX for state management easy to understand and also reliable

Upvotes: 0

Shenith Sandeepa
Shenith Sandeepa

Reputation: 516

You can use redux, Context, react hooks and AsyncStorage also. But using AsyncStorage is not the best option to manage a store. It will slow your app and you can use AsyncStorage to save username, tokens, sessions etc. In my opinion, using react hooks is the best method to manage a store.

Upvotes: 1

Related Questions