State management and Storage
Redux toolkit:
State management is a vital chore feature of a mobile application, as it allows us to share multiple variables across the whole application.
In our template, we are using redux with the help of the redux-toolkit library.
We chose this library for many reasons:
- It provides an easy setup for redux, and you focus only on the core logic so that you can do more work with less code.
- It forces the developer to follow the
slices
principle, making it easy to scale your store. - Redux is the most stable state management for react projects generally.
Persisting the data of the store:
To persist the store's data, we are using the library React native MMK, to securely store the data in the phone's storage instead of using AsyncStorage. MMKV is an efficient, small mobile key-value storage framework developed by WeChat. See Tencent/MMKV for more information.
This choice was made because of the following reasons:
- Fully synchronous calls, no async/await, no Promises, no Bridge.
- Encryption support (secure storage)
- ~30x faster than AsyncStorage
- High performance because everything is written in C++
You can check more details in their documentation.