react-nativeapiweb-servicesofflineapps

How can I make a React native app offline?


I have a react native application to answer evaluations with different fields and load images. I need to make than the user can login and answer the evaluations offline and when the device its online, use the Web Services to load the answers automatically.

I am using React Native with Expo and Web Services to get data of forms.

Any idea where to start or how can i do it?


Solution

  • First, you need to check to internet connection, to make sure the device is online or offline. For this, you can use this library @react-native-community/netinfo.

    Second, you need to store the question and answer on redux, so when the device is offline, you can load the question from redux. When the device is online, you can load the question from api.

    Hope this works for you.