offline-redux.mo
Owner: Maxime Sraïki
Control Points
If you want to make your application work offline, you'll need to check that
Motivation
Your application has to be used in a low connectivity context (abroad, far from towns, in the subway, in Darius's house, ...)
Prerequisites
MobX User ?
If you're using Mobx, check this out
Steps
Knowing wether or not you're offline (~20min)
Reading data offline (~15m)
Control points
Use redux-persist
.
Writing data offline (~30m)
With Redux-Offline
You can use redux-offline
, basically it provides you with all the ACTION, COMMIT, ROLLBACK logic that let you implement optimistic or defensive offline design.
To build something optimistic, do the state change on the ACTION, leave the COMMIT empty and rewind the application state on the ROLLBACK.
To build something defensive, change to a pending state on the ACTION and do the definitive state modification on the COMMIT only, the ROLLBACK is still a rewind of the application state.
If you are also implementing sagas, take a look at this issue
Without Redux Offline
We also implemented writing feature without redux offline on a project @BAM, let me know if you want to know more !
Tips & TroubleShoot
In order to be able to detect this, you can use the react-native's
NetInfo.isConnected
function to get the connectivity status your phone thinks it has.There are ways to check user's connectivity by pinging one of your own server routes instead of basing it on the phone self awareness of its connectivity.
We did not implement offline calls that would need conflict management (several users able to access the same data at the same time) yet.
Last updated