Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16750

Best way to structure an app which stores user data

$
0
0

I'm having trouble with an app that I'm making in that I'm unsure of the best way to structure the different components/screens. Specifically, I have a user login feature and currently, I would like to all my different screens to be able to access the data of that user (e.g. their name, email address). I tried using AsyncStorage, however, the problem with this is that my components render before I can retrieve the user details from AsyncStorage, so my home page looks like this:

enter image description here

I.e. the user's name is not displaying after "Good afternoon ...". Additionally, I'm unsure of how ideal using AsyncStorage is for performance, so I'm considering refactoring my app. I use firebase to store my user details and am certain that consistently retrieving the data using the firebase library is bad for performance.

What is the best way to structure my app for this user purpose? I've read about Redux, Context etc. Also, every screen I have is written as a React component, and then in my App.js I make my bottomTabNavigators and stackNavigation using these components, then output them in an App Container. Is this the best way to do it for my purposes? Any advice would be appreciated. Thanks in advance!


Viewing all articles
Browse latest Browse all 16750

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>