E
E
egorkozelskij2020-10-19 11:58:27
React Native
egorkozelskij, 2020-10-19 11:58:27

How to download MobX data correctly?

Question about React Native + MobX. All application data is stored in Sqlite database tables.

I'm interested in how to more correctly load the data in the Store - once - entirely during the application load. Or Partially, during the loading of each screen?

Once - globally

  • Loading occurs in componentDidMount all data at once. As soon as the data has loaded - a callback that opens the initial screen of the application
  • In each screen, getters fetch the data that is needed in this screen


Partly and often
  • At the loader, only user data is loaded and stored in the store
  • Each screen in componentDidMount requests its data and is already working with it
  • What will be more correct?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
davidnum95, 2020-10-19
@davidnum95

What will be more correct?

Depends on the nature of the data. If this is some kind of list with pagination, filters, etc., then it is better to do this in a specific screen. If it’s just static data that does not change, then you can load it at the start of the application.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question