require('whatwg-fetch') const React = require('react') const ReactDOM = require('react-dom') class ResourceList extends React.Component { constructor(props) { super(props) this.state = { loading: false, items: [], } } componentWillMount() { this.setState(Object.assign({}, this.state, { loading: true })) fetch('http://app.tubbsfireinfo.com/recent_news.json') .then(response => { return response.json() }) .then(json => { console.log('parsed json', json) this.setState( Object.assign({}, this.state, { items: json, loading: false }) ) }) .catch(ex => { console.log('parsing failed', ex) this.setState(Object.assign({}, this.state, { loading: false })) }) } render() { return } } function List({ loading, items }) { if (loading) { return (

Loading news...

) } return ( ) } function Item({ item }) { return (
  • {item.fields.Description}
  • ) } ReactDOM.render(, document.getElementById('resource-list'))