So this is index.js (my entry point) and I'm loading the json data here
import React from 'react';
import ReactDOM from 'react-dom';
import fetch from 'isomorphic-fetch';
import {Filter} from './src/filter';
fetch('./pizza.json')
.then(function(response) {
return response.json()
}).then(function(json) {
console.log('parsed json', json)
}).catch(function(ex) {
console.log('parsing failed', ex)
});
ReactDOM.render(<Filter />, document.querySelector('.content'));
Now in filter.js where I want to render the contents of the page, I'm not sure how to use the loaded data in index.js, here in filter.js
import React, {Component} from 'react';
export class Filter extends Component {
render() {
return (
<div>
<h1> Pizza Search App </h1>
</div>
);
}
}
I'm new at React.js and am trying to learn, having trouble understand basic react.js fundamentals, help!