reactjsdatabasereact-nativeasyncstoragedata-storage

Is it possible to prepopulate React Native async storage with static data


I am creating an app with a lot of static text, and I am looking for a way to store it in a clean way. Is it possible to bundle an app with a prepopulated async stroage? Or is there any clean way to store a lot of text in a react native app?


Solution

  • The simple way is to put texts in json file and import that.

    {
        "lotOfText1": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
        "lotOfText2": "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."
    }
    
    import texts from '<path-here>/texts.json';
    
    texts.lotOfText1