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? 回答1: 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. 回答2: ES6/ES2015 version: import customData from './customData.json'; 回答3: For ES6/ES2015 you can import directly like: // example.json { "name": "testing" } // ES6/ES2015 // app.js import * as data from './example.json'; const word = data