- Completed Redux vs Zustand vs Jotai comparison - Redux Toolkit selected (9.2/10 score) - Best for complex state (family structure, permissions) - Best for offline sync (RTK Query, optimistic updates) - Largest ecosystem (most resources, tutorials, examples) - Best developer experience (time-travel debugging) - 100% code sharing between React Native and React Trade-offs: - More boilerplate (clearer structure) - Steeper learning curve (better patterns) - Larger bundle 60KB vs 3KB (negligible impact) Updated tech stack decisions and README Next: Authentication system design (JWT with recovery phrases)
2.4 KiB
2.4 KiB
State Management Decision Summary
Date: 2026-02-14 Decision: Redux Toolkit 2.x
Scorecard
| Criterion | Redux Toolkit | Zustand | Jotai | Weight |
|---|---|---|---|---|
| Code Sharing | 10 | 10 | 10 | Critical |
| Bundle Size | 7 | 10 | 10 | Critical |
| TypeScript | 10 | 10 | 10 | Critical |
| Complex State | 10 | 7 | 5 | Critical |
| Offline Sync | 10 | 7 | 5 | Critical |
| Weighted Score | 9.2 | 8.6 | 7.6 | - |
Decision: Redux Toolkit 2.x
Score: 9.2/10
Key Advantages
-
Best for Complex State
- Family structure, multi-person profiles, permissions
- Built-in normalization (createEntityAdapter)
- Predictable state updates
- Time-travel debugging
-
Best for Offline Sync
- RTK Query for server state management
- Optimistic updates
- Background sync support
- Battle-tested offline patterns
-
Best Ecosystem
- Largest ecosystem
- Most resources, tutorials, examples
- Most production deployments
- Easiest to hire developers
-
Best Developer Experience
- Time-travel debugging
- Predictable state updates
- Easy to debug
Trade-offs
- More boilerplate: More code, but clearer structure
- Steeper learning curve: More concepts, but better patterns
- Larger bundle: 60KB vs 3KB (negligible impact on 50-100MB app)
Technology Stack
Shared (Monorepo)
- State Management: Redux Toolkit 2.x
- Data Fetching: RTK Query 2.x
- Async Thunks: createAsyncThunk
- Persistence: Redux Persist 6.x
- Selectors: Reselect 5.x
- DevTools: Redux DevTools
Alternative Considered: Zustand
Score: 8.6/10
Why Redux Toolkit wins:
- Better for complex state (family structure)
- Better for offline sync (RTK Query)
- Larger ecosystem (more resources)
When to use Zustand instead:
- If team has no Redux experience
- If state is simpler (no family structure)
- If development speed is more important
Next Steps
- Implement Redux Toolkit POC
- Create family structure state slice
- Implement RTK Query for server state
- Test offline synchronization
- Test encrypted data caching
- Make final decision
Implementation Timeline
- Setup Redux Toolkit: 1 day
- Create state slices: 2-3 days
- Implement RTK Query: 2-3 days
- Implement offline sync: 3-5 days
- Test encrypted caching: 2-3 days
- Evaluate DX: 1-2 days
Total: 11-17 days (2-3 weeks)