If your React Native app needs to survive being killed by the OS, the most common advice is: persist your store. Use redux-persist, Zustand's persist middleware, or similar, and rehydrate on launch.
It's good advice for some state. For long multi-step flows like checkout, onboarding or applications, I think there's a better fit. Here's an honest comparison.
Approach 1: persist the store
Serialize the store (or a whitelist of slices) to storage on change, and load it back at startup.
Where it shines
- App-wide preferences: theme, language, "has seen the tutorial".
- Caches you'd rather not refetch.
- Very little code, and it's well known.
Where it hurts for flows
- Granularity. Writes are tied to store changes, not to meaningful moments like "the user finished step 2".
- Secrets. Anything in the persisted slice is written. You have to remember to blacklist a card number, and remember again when someone adds a new field.
- Validity. Rehydration loads whatever is there. A snapshot from an older app version, a half-written one, or one from three weeks ago all come back the same way.
- No user choice. The user lands mid-flow with no "resume or start over?" moment.
Approach 2: a checkpoint per flow
Each flow gets its own record. You save at meaningful moments, and on the next launch you check whether there's something worth restoring before you offer it.
This is what react-native-journey-recovery does:
const journey = useJourney<Checkout>('checkout');
// after the shipping step
journey.checkpoint({ step: 'payment', address }, { exclude: ['cardNumber'] });
const recovery = useRecovery<Checkout>('checkout');
if (recovery.available) {
// show "Resume checkout?" and call recovery.restore() or recovery.discard()
}
What you get that store persistence doesn't give you by default:
| Concern | Store persistence | Per-flow checkpoint |
|---|---|---|
| What's written | The whole slice | Only the flow's data, minus excluded fields |
| Corrupted / half-written data | Usually loaded, or crashes on parse | Checksummed; reported as invalid, never restored |
| Old app version wrote it | Manual migrations |
version + migrate(); newer snapshots are rejected |
| Stale data | Lives forever unless you clean it | Sliding or absolute expiry |
| User control | None | Explicit available / restore() / discard()
|
| Tied to state manager | Yes | No; works next to Redux, Zustand, or plain useState
|
They're not mutually exclusive
I still persist preferences with the store. The split that works for me:
- Store persistence for small, long-lived, non-sensitive app state.
- Journeys for anything with steps that a user would be annoyed to redo.
The status model is the real win
The part I like most is that every outcome is an explicit status your UI can switch on:
| Status | Meaning |
|---|---|
checking |
Reading storage |
idle |
Nothing saved |
available |
A valid checkpoint can be restored |
expired |
Saved, but past its expiry |
invalid |
Corrupted, failed validation, or saved by a newer app version |
completed |
The journey finished; not offered for resume |
failed |
A save, read or restore failed; see error
|
With store rehydration, most of these cases are silent. With a status, you can show the right UI (or log the right event) for each one.
You can try each case in the live playground by killing the app, corrupting storage and expiring checkpoints in the browser.
Which do you use today? If you persist the store for flows, how do you handle stale or half-written data?
react-native-journey-recovery: Checkpoint multi-step flows in React Native and Expo and restore them safely after the app is killed, crashes, or goes to the background.
Docs · Playground · GitHub · npm
Top comments (1)
The per-checkpoint exclude is the part I'd adopt even without the library. With a persist whitelist, a newly added sensitive field gets written by default unless someone remembers to blacklist it, which is backwards for checkout data. One question: where do checkpoints live by default? In application-style flows the non-card fields (address, date of birth, ID numbers) are still personal data, so I'd want an option to back the storage with something encrypted like Keychain/Keystore rather than plain AsyncStorage.