k_roszczak
k_roszczak

Reputation: 1

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?

Upvotes: 0

Views: 81

Answers (1)

user18309290
user18309290

Reputation: 8370

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

Upvotes: 1

Related Questions