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

mrded picture mrded · Apr 5, 2015 · Viewed 130.2k times · Source

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

Answer

peter picture peter · May 16, 2015

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

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

and then access customData like a normal JS object.