I have the following react component.
import React, { Component } from 'react';
class GraphView extends Component {
constructor(props){
super(props);
this.state = {
datajson: ''
};
}
componentDidMount() {
$.ajax({
url: 'data.json',
dataType: 'json',
success: function(data) {
this.setState({datajson: data});
}.bind(this)
});
}
render() {
return(
<div>
...
</div>
);
}
}
export default GraphView;
when I try to load the local json file "data.json", it is showing a not found error. Do I need to pass any other parameters? My local json file resides in the same folder as that of GraphView.