Search code examples
reactjsreduxredux-persist

What is the best way to store objects in React Native; redux-persist or localStorage


I want to store some data in my react native app. Which one is the best practice; redux-persist or localStorage?


Solution

  • localStorage is one of the store engines for redux-persist. See https://github.com/rt2zz/redux-persist#storage-engines. They are not the same thing and cannot be compared. redux-persist is in addition to the storage engine, Redux persist ships with react integration as a convenience, and generally speaking, it is enough to use.

    redux-persist provides some state Reconciler strategies that can help you reconcile states easily.

    You can decide which state slice should be persisted to the store engine using Blacklist & Whitelist feature.