import "whatwg-fetch" import React, {PropTypes} from "react" import ReactDOM from "react-dom" import Message from "./components/Message.jsx" const Page = React.createClass({ getInitialState() { return {msgs: [], loading: false} }, propTypes: { msgs: PropTypes.array, source: PropTypes.string.isRequired }, render() { var nodes = this.state.msgs.map(msg => { return () }); return (
{nodes}
) }, componentDidMount() { fetch(this.props.source) .then(response => { return response.json() }) .then(data => this.setState({ msgs: data }) ).catch(ex => { console.log(ex) }); } }); ReactDOM.render(, document.getElementById("content"));