mrded mrded -5 years ago 2414
JSON Question

How to fetch data from local JSON file on react native?

How can I store local files such as JSON and then fetch the data from controller?

Answer Source

Since React Native 0.4.3 you can read your local JSON file like this:

var customData = require('./customData.json');

and then access customData like a normal JS object.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download