I was trying to do the same thing and this is what worked for me (ES6/ES2015):
import myData from './data.json';
I got the solution from this answer on a react-native thread asking the same thing: https://stackoverflow.com/a/37781882/176002
More Related Contents:
- React JS – Uncaught TypeError: this.props.data.map is not a function
- React Js: Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0
- Why does Google prepend while(1); to their JSON responses?
- jQuery AJAX cross domain
- AJAX cross domain call
- Add a “hook” to all AJAX requests on a page
- What is the cleanest way to get the progress of JQuery ajax request?
- Ajax request returns 200 OK, but an error event is fired instead of success
- Chrome refuses to execute an AJAX script due to wrong MIME type
- XMLHttpRequest status 0 (responseText is empty)
- Why am I seeing an “origin is not allowed by Access-Control-Allow-Origin” error here? [duplicate]
- Is onload equal to readyState==4 in XMLHttpRequest?
- How can I send the “&” (ampersand) character via AJAX?
- What do the different readystates in XMLHttpRequest mean, and how can I use them?
- WebKit “Refused to set unsafe header ‘content-length'”
- Use componentWillMount or componentDidMount lifecycle functions for async request in React
- Get HTML code using JavaScript with a URL
- Is it possible for XHR HEAD requests to not follow redirects (301 302)
- send json object from javascript to php
- jQuery AJAX Call to PHP Script with JSON Return
- console.log(result) prints [object Object]. How do I get result.name? [duplicate]
- Execute function after Ajax call is complete
- Overriding XMLHttpRequest.open()
- XMLHttpRequest 206 Partial Content
- Ajax – 500 Internal Server Error
- Annoying javascript timezone adjustment issue
- SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
- Opinion about synchronous requests in web workers
- XmlHttpRequest.responseText while loading (readyState==3) in Chrome
- How to return an array from an AJAX call?