4

I am newbie on react-native. I am trying to read data from large json file placed in project directory. But my app crashed giving alert "Unfortunately Project has stopped", when build. I spent much time on searching online but unable to get proper information. How to do this task.

This is my file path "./msg/message.json"

import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View, Button} from 'react-native';

var myMsg = require('./msg/message.json');

type Props = {};
export default class App extends Component<Props> {
  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>Welcome to React Native!</Text>
        <Text style={styles.instructions}>To get started, edit App.js</Text>
        <Text style={styles.instructions}>Text</Text>
        <Button title="Login"></Button>
      </View>
    );
  }
}

0 Answers0