Search code examples
databasereact-nativeexpooffline

How to Store long texts in offline react native app?


I'm building a tutorial app with react native. I designed it well but I have no idea how can I store it's data.

I think to Store in object like this...

Tutorial = [
  { 
Intro : {
    "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incid quis.."
},
     content : {
      Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do sunt in culpa qui officia deserunt mollit anim id est laborum...
    },
    conclusion : {
      Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmo...
    } 
    }
]

But I don't think it's a good idea to achieve this.

I'm so curious about how most of offline programming app developed. Probably most of you know app like programming hub, mimo... Etc

So please mention me how I can achieve this in my react native app


Solution

  • For most smaller data you can use AsyncStorage from react-native, but there are more data then you can use Realm and SQLite these are libraries to store data on device.

    https://www.npmjs.com/package/react-native-sqlite-storage

    https://github.com/realm/realm-js