8
votes

Need suggestion on which library to use for a large react native mobile app using redux ? redux-offline or react-native-offline ?

I need to regularly check connection status, render view depending on the connection status, add actions to queue when offline and run them when online, cancel actions if some contradiction is there, and persist/rehydrate data offline.

3
I would suggest redux-offline.ParthS007

3 Answers

3
votes

I am using redux-offline in my react-native project, it works just great. The feature that you are looking for all are presents like

  1. It regularly checks for connection status
  2. Add action to offline anytime (online \ offline)
  3. Run the action as soon as device became online (moreover, you can decide the retry interval)
  4. You can write your own discard method to drop any action based on your business requirement.
  5. It uses redux-persist which automatically persist\rehydrate data. Also, you can provide your own store mechanism.

redux-offline is working just great for me, Sorry, I haven't used react-native-offline yet so can't provide you any benchmark.

1
votes

I have evaluated both, and for my use case I decided to go with react-native-offline. I liked its integration and ease of setup with redux-sagas, and it's offlineQueue was very convenient to have when you expect your users to conduct many operations offline.

1
votes

I would suggest going for react-native-offline.

React-native-Offline provides :

  1. Easier queue handling for actions based on a regex expression or a list of actions
  2. Auto Triggering the online only actions , once the network is back.
  3. Your Saga looks cleaner and readable, with both online/offline cases , on a maintenance perspective.

Redux-Offline provides:

  1. It basically on separate online and offline actions
  2. Each action and associated rollback needs to be handled

Both provides the redux-presist with connectors of your preference.