Handling Offline Mode in React Native

Handling Offline Mode in React Native

Delving into the world of React Native, we explore the intricacies of handling offline mode. A crucial aspect for any application, we'll unravel the techniques to ensure seamless user experience, even without internet connectivity.

Conclusion

We have discussed all scenarios of handling data locally, as well as Redux and Redux-Persist that help a lot with developing the offline mode of the mobile app.

Data Sync

Syncing is a concept used to make sure that both the local app and the server’s data are the same at all times

How to Implement the HPA?

Example: Create a docker container that runs Apache and PHP

Advantages and disadvantages of HPA

Reduced cost: You don’t have to guess the number of nodes or pods needed to run your workloads

Architecture in React Native

To implement an architecture that checks all the concepts discussed above, we need some help from libraries like Redux-Persist and NetInfo

Fetch Data Request Flow

In case the internet is not working, the movies list will be populated from locally-saved data using redux-persist.

Offline Mode

As app developers, we strive to eliminate as many inconveniences on the user’s side as possible

Conclusion

The main advantage of autoscaling is that resources are not over-provisioned.

Authorization in Offline Mode

Normally, auth token & refresh token are used for authorization. If the token is not refreshed at a specific time, it expires.

Horizontal Pod Autoscaler (HPA) in Kubernetes

Let’s try to understand autoscaling and why we need it

Types of Autoscaling in Kubernetes

Horizontal Pod Autoscaler

Migration

With redux-persist, whenever there is a structural change, the version number will be incremented.

Post Data Request Flow

If the internet is not working, the request data will be stored in sync_queue and at the same time persisted in redux-persist

What is HPA and where does it fit in the Kubernetes ecosystem?

HPA is a controller that lies in one of the components called ‘kube-controller-manager’ and is configured by HorizontalPodAutoscaler resource objects.

Metrics Server

A scalable, efficient source of container resource usage metrics for Kubernetes’ built-in autoscaling pipelines

How to develop a mobile app if the internet is not working

First, the UI/UX should reflect the fact that we are in offline mode.

Source

Get in