Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to store global data in AsyncStorage or redux?

I am developing a feature like a cart of which data I want to use in multiple screens. Also, want to manage the view cart and clear cart items but locally only. What is the recommended way to go with?

1) AsyncStorage 2) Redux

Kindly help me and let me know if there is a misconception on my side.

like image 872
K.Raj. Avatar asked Oct 25 '25 15:10

K.Raj.


1 Answers

AsyncStorage and Redux serve different purposes.

AsyncStorage is there to allow you to store data that is persisted between app instances (that is, between restarts of your app).

Redux is a state management system that is meant to solve the problem of moving state around components in react.

What you're describing can actually use both, where Redux is used for state management, and the redux store itself can be saved into AsyncStorage for later use. There are Redux related libraries that do just that, such as Redux-Persist.

like image 135
Kraylog Avatar answered Oct 28 '25 05:10

Kraylog



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!